Does browser treat "id" and "class" as the same, even though they have different meaning?

Member Avatar
diafol

Depends what you're using them for. As a rule of thumb each 'id' can only be declared once, whereas you can have as many identical 'class' values as you want on a page. The id and class are used extensively as 'hooks' for css and javascript.

In CSS, 'ids' are denoted with a # symbol before the id value and classes with a . symbol. Javascript frameworks such as jQuery have also gone for this notation.

commented: Very clear and straight to the point :) +0
commented: beat me to it... again :P +1