tags:

views:

44

answers:

4

what's the difference between Element and Element ID?

+4  A: 
<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.

Felix Kling
A: 

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.

Zyphrax
@Felix: done :)
Zyphrax
+1  A: 

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.

Thomas
A tag is the structure of the element, and is not synonymous with the element itself. They include start and end tags.
Anonymous
A: 

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

Ilian Iliev