what's the difference between Element and Element ID?
<div id="element-id"></div>
The element is div
, the element's ID is element-id
.
Note that every ID should be unique in the DOM tree.
CSS has many selectors:
a { color: red; } - all hyperlinks
#firstname { color: red; } - any html object with id: firstname
.firstname { color: red; } - any html object with class: firstname
For more info: http://www.w3.org/TR/CSS2/selector.html
The element is the actual HTML element (tag).
The element's ID is the HTML element's id attribute.
In the DOM, an Element is what you would call a "tag" in HTML-speak, for example <a id="myanchor">Hello world!</a>
. That Element's ID is myanchor
.
This answers the question, but I'm not sure if it's what you wanted to know... and it has nothing to do with css-layout
.
Element { border: 1px solid red; } This will affect all elements form this type
Element#ID{ border: 1px solid red; } Will affect the element with this ID only if it is form the spcified type (Element)
Examples:
div{ color: red; } All inputs will have red text
div#my_input{ color: red; } my_input will have red text only if it is a DIV