Five major selectors in CSS

  • Tag Selector
  • Id Selector
  • Class Selector
  • Grouping
  • Nesting

GODZEALOUS | CSS Tutorial di Bali, Kursus Android di Bali, Kursus Website di Bali, Kursus mahasiswa komputer informatika di Bali, Website Designer Bali

GODZEALOUS | CSS Tutorial di Bali, Kursus Android di Bali, Kursus Website di Bali, Kursus mahasiswa komputer informatika di Bali, Website Designer Bali

GODZEALOUS | CSS Tutorial di Bali, Kursus Android di Bali, Kursus Website di Bali, Kursus mahasiswa komputer informatika di Bali, Website Designer Bali

GODZEALOUS | CSS Tutorial di Bali, Kursus Android di Bali, Kursus Website di Bali, Kursus mahasiswa komputer informatika di Bali, Website Designer Bali

CSS Selectors with use

Selector Way to write Use
Tag Selector p{} Used to call all p tags
ID Selector #para{} Used to call that unique element with id para.
Class Selector .para{} Used to call group of different elements with class para
Tag with Class Selector p.para{} Used to call only p elements with class para
Grouping Selector h1, h3, h5{} Used to group

,

elements
Nesting Selector div p{} Used to call only p elements with parent div.
Universal Selector *{} Used to call all elements in web document.

Tag Selectors

(How to write a CSS in HTML code)


<html>
<head>
<title>Title of Webpage</title>
<style>
h3{ color:red}
p{ color:blue; text-align:center}
</style>
</head>
<body>
<h3>This heading will be red.</h3>
<p>This text will be blue and center align.</p>
</body>
</html>