CSS Rules
This section will learn about CSS Rules
Before we begin to learn about CSS (Cascading Style Sheets). We need to know what is the CSS Rules itself, so basically css rules is the foundation of how you style and present HTML content on a webpage. A CSS rule consists of two main parts:
selector {
property: value;
property: value;
/* More declarations if needed */
}
-
Selector: This determines which HTML elements the rule applies to. It can target elements by type, class, ID, attribute, or more advanced selectors like grouping.
-
Declaration Block: This contains one or more declarations enclosed in curly braces . Each declaration consists of a property and a value, separated by a colon :. The declaration block controls how the selected elements will be styled.