Forum Moderators: not2easy
idcan be the target for a hyperlink. So you can do
<p id="foo"> <p><a name="foo"></a> <a href="/this/page#foo"> nameattribute has been dropped.
So an
idmust be unique on a page, and should carry some semantic meaning (ie, as something you might conceivably link to). A
classis more generic, denoting a set of element of the "same" sort.
To further clearify your excellent explanation: just think about the names...
ID = identifier... class = group...
Every person has some form of unique ID, a drivers licence or passport or whatever, and it works the same way on Web pages.
ID = unique
class = group, no matter if there's one or a few thousand elements in the group
ie.
.container {
border:thin black groove;
font-size:80%;
}
#left {
position:absolute;
top:0;
left:0;
width:20em;
}
#main {
top:0;
left:20em;
}