Css selectors You've now learned about three kind of css selectors: ​type​


Download 78.61 Kb.
Pdf ko'rish
Sana19.10.2020
Hajmi78.61 Kb.
#134832
Bog'liq
ipnd-reference-sheet-css-selectors

background image
 

 

CSS Selectors



 

You've now learned about three kind of CSS selectors: ​type​, ​class​

and ​ID​

 

 



 



Type​ selectors are used to apply a style to a particular type of HTML element, like ​

h1​

 or 


body​

.  


Type selectors are written using just the type name. 

 



Class​ selectors are used to set the style for multiple HTML elements that have a particular 

value for the ​

class​


 attribute.  

You can name a class anything you want! Class selectors are written with a dot before the 

class: for elements such as ​

, the class selector is ​



.blue​

 





ID​ selectors are used when the style is being applied to one HTML element, which has to 

have an ​

id​

 attribute.  



There can be only ​one ​element with a particular ​

id​


 on a page. You can also choose any name 

you want for an ​

id​

, just like a​



 ​class​

. ID selectors are written using a ​

#​

 sign: for an element 



such as ​

, the ​


id​

 selector is ​

#sidebar​

.

 



 

version 1.0



 

Download 78.61 Kb.

Do'stlaringiz bilan baham:




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling