html - What's the difference between CSS id selector and CSS class selector? -
this question has answer here:
for example, can same results following 2 ways.
<html> <head> <style type="text/css"> p#red{color:red} /* css id selector*/ p.green{color:green} /* css class selector*/ </style> </head> <body> <p id="red">red color</p> <p class="green">greencolor </p> </body> </html>
they both can give me colored text. difference between them? answer.
id's unique each element can have 1 id. each page can have 1 element id classes not unique can use same class on multiple elements. can use multiple classes on same element. more about
Comments
Post a Comment