CSS Selectors
What are CSS selectors, and how they are initialised
What are CSS selectors, and how they are initialised
What are declaration blocks, and what goes inside these declaration blocks
What properties and values are
How properties and values are related and how they affect HTML elements
CSS selectors select any particular HTML element type, class or id attribute
Selectors that precede with a dot (.) select elements with a particular class
Example:- .class-selector { }
Selectors that precede with a hash (#) select element with a particular id
Example:- #id-selector { }
Lastly, selectors that are initialised with HTML element tags such as h1, or p tags etc, are type selectors
Example:- h1 { }
A CSS declaration lies within the declaration block, and consists of the propery and value which are shown just below
Declaration blocks are initialised using the curly braces({ }), and everything in-between is where the magic happens
Declaration example:-
#selector {
property: value;
}
Properties and values are in charge of how an element looks and in some cases how it reacts to basic user interaction
An example of a property and value working together:-
#selector {
color: blue;
}