Jump to content

What is meant here?


SWEngineer

Recommended Posts

In this HTML/CSS http://css.maxdesign.com.au/listamatic/horizontal02.htmUnder HTML:<div id="navcontainer">But, navcontainer is not included in the CSS section, what is this id supposed to do?Under CSS:What does the following mean?ul#navlist#navlist liAnd, what is the difference between those two different forms? I mean here, the way the preceding is written. In the first script I see for example ul BEFORE #, and in the second one, I see that li is AFTER #.Can you explain that?Thanks.

Link to comment
Share on other sites

IDs are not only used by CSS, so perhaps navcontainer is an id used by JavaScript to find the div. It's good practice to give major structures in your code an id because you will almost always wish to style them and it's the easiest way of selecting them.ul#navlist - means the unordered list with the id 'navlist'#navlist li - means all list items in the element with id 'navlist' (which we know to be an unordered list)The hash/pound sign (#) is used to select elements with a certain id, and the . syntax (for example, div.red) is used to select elements with a certain class. Classes can be used more than once on a page, but ids are unique. Note in the above examples that if ul#navlist had been written with a space - ul #navlist - the style would be applied to the element with id 'navlist' that is a child of any unordered list. I hope that helps.

Link to comment
Share on other sites

It is generally a good idea to give major and semi-major structures an ID so that you know what your looking at when you see it. Debugging a page in something like DOM Inspector is also a lot easier if a structure has an identifier.All this is quite separate from CSS and JavaScript utility.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...