CSS-->Part 01-->Selector
In this class, we are going to study selector
Why do we use Selector?
Selector is used to selecting the element we want to style from HTML.
6 types of selectors are used
Universal
Individual
Class and ID
And
Combined
Direct child
Universal Selector: -
It is used to select the whole HTML page
Syntax : -
*{
<---code--->
}
Example: -
Individual Selector: -
These are selectors which is used to target the individual element like: -
<p> ,<h1>....to ....<h6>,<span> and etc
Class and Id Selector: -
This is mostly used, selectors.
Class selector represents by-->.
Id selector represents by--->#
And Selector: -
It will select only those elements that both cond. is true like AND
Question: -In HTML we have a 2 class name of "bg-black" and "bg-black text-white" but we have select one even the both name is common than we use AND Selector.
Combined Selector: -
We select more than one element on HTML like
If we didn't use the Combined operator, we have to select p differently and span differently to change the color and background color.
Direct child Selector: -
The CSS child selector uses the > character to target an element that is a direct child of an element type.