Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

the meaning of css format starting with "* html"

 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does anyone know the meaning of the stuff below starting with "* html...." in this sample CSS file?

What is the difference between the stuff starting with "* html..." and the regular one on top of it?




Thanks in advance.
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
http://css.maxdesign.com.au/selectutorial/selectors_universal.htm

Eric
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It is not going to make a difference if you leave

* html out

Eric
 
Michael L. Zhang
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks, Eric. That is very helpful info.

What is the difference between "* html #subnav .item" and "#subnav .item" in a CSS file then?
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It is descendant selectors:

http://css.maxdesign.com.au/selectutorial/selectors_descendant.htm

In general it is goes from top level element down navigating the document tree.

* html #subnav .item in plain English reads

Apply these rules to element with the class set to "item", which is contained within an element with an id of "#subnav", which is contained in an element "html", which is under the entire "document"

Not since we can only have ONE id on the page that is why #subnav .item produces the same thing

Lets change it up a bit without an id

Rule 1
div span em

and

Rule 2
span em


Rule 1 and 2 both work here


Rule 2 only works here


Hopefully that makes sense.

Eric
 
Michael L. Zhang
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Eric, thanks.
 
I will suppress my every urge. But not this shameless plug:
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic