In CSS, you can assign either a class or an id to an element.
Classes are defined with a dot (.) whereas IDs are defined with a #.
They have the main purpose but you cannot use # with class="" or . with id=""
The main difference between the two is that id is unique and can be used only once/page unlike class that can be used for as much elements as you want.
ID:
If in HTML, you have
in CSS you have to associate
CLASS:
If in HTML, you have
in CSS you have to associate
Notice that you can not interchange the codes, in which case it won't work.
Classes are defined with a dot (.) whereas IDs are defined with a #.
They have the main purpose but you cannot use # with class="" or . with id=""
The main difference between the two is that id is unique and can be used only once/page unlike class that can be used for as much elements as you want.
ID:
If in HTML, you have
in CSS you have to associate
CLASS:
If in HTML, you have
in CSS you have to associate
Notice that you can not interchange the codes, in which case it won't work.
Donation:If you like our free quality work, make a donation by using Paypal and tell us what you would like to see improved on our site for the next few months. |
|
No comments yet













Page Info












