Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CSS programming style - universal selector

Status
Not open for further replies.

JGH

Programmer
Joined
Feb 1, 2001
Messages
21
Location
US
Okay, CSS isn't a programming language, but you get the idea... Today I was getting acquainted with the universal selector (*) in CSS, and was wondering what is approrpiate use/good programming style with this all powerful selector?

For instance, most of my sites use the same font-family for all elements (maybe one or two exceptions), and I could either set in the stylesheets something like:
Code:
BODY, TH, INPUT, etc. etc. { font-family:verdana }

or I could just do:
Code:
* { font-family:verdana }

and take a nap.

Any reason, stylistically, intuitively, or otherwise, why I shouldn't?

Thanks - Jim
 
So long as you accept that EVERYTHING on your page will now use verdana.

You may find that some older browsers don't like the selector, but if they show up, it probably won't be enough of a blip to warrant being described as a problem.

Foamcow Heavy Industries - Web design and ranting
Buy Languedoc wines in the UK
 
When paired with the child selector, it's a useful CSS hack to hide things from IE:
Code:
[COLOR=red]*>[/color]foo {
  font-family: verdana;
}

---
Marcus
better questions get better answers - faq581-3339
accessible web design - zioncore.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top