tags:

views:

47

answers:

4

Let's say that I want to specify Arial in the HTML header - and I want it to apply to everything.

Do I have to list each element type explicitly? Or can I set them all with a single statement?

+8  A: 

You can use the * selector which applies to everything:

<style>
* {
    font-family: Arial;
}
</style>

Note that this may be overkill for your purposes - due to the nature of CSS, styles set on parent elements are generally inherited by child elements, and thus, it's usually enough to set a font style on the body element to apply to the entire page.

body {
    font-family: Arial;
}
Amber
Mawg
Just wrap it in `<style>` and `</style>` tags (within the `head`). I edited the answer to show what I mean.
Amber
+1 again - and the answer - thanks! Sorry to be such a n00b. I think I'll go buy a book, or read a few tutorial sites :-)
Mawg
A: 

Use CSS as:

* {
  font-family: "Arial"
}
naikus
+1  A: 

No, generally specifying it on body is enough. That’s what the C in CSS is for: cascading. That means elements inherit the properties of their parent element. So anything under body (which should be everything) will inherit the font automatically.

body { font: 12px Helvetica, Arial, sans-serif; }
Todd Yandell
+1  A: 

I prefer

body {
   font-family: Arial;
}

and let it cascade down. This has the advantage of not stomping on explicit font selections further down the tree. If you want to stomp, use the * form in other answers

msw
If you really want it to be arial no matter what, you can still do this and use !important, right?
Jouke van der Maas