+ 3
Hi, what is difference between id and class?
5 Respostas
+ 5
hi,
id must be unique, class could be reused
+ 4
@shashi prakash:
<a href="#me">
... with hashtag sign ( # ) it's better ;)
+ 2
@visph Sorry i mistyped there.
yes it's with hash tag.
+ 1
as visph said, to link to an id the uri must be #idname
Classes can be scrolled to/linked to using javascript
Both classes and id can be used to style.
Custom attributes as of HTML5 can also be used and linked to.
0
ID can be used for linking.
Class is only used for styling.
Examples -
<div id=me class=you>
in HTML
You can use id i.e me for linking.
<a href="me">