Syntax : The structure of CSS is simple—it comprises selectors and declarations. A selector identifies the HTML element you wish to style while a declaration block consists of declarations separated by semicolons. Each declaration specifies a property and its corresponding value, in the format property; value.
Selectors : Elements in an HTML page are identified by names called selectors, which allow you to access and modify them using CSS. A variety of selection types exist:
Type selectors focus on elements in HTML such as div, h1, and p.
Class selectors preceded with a period (. ), target items with certain classes.
ID selectors focus on items that have certain IDs that are preceded by a hash (#).
Declarations : A declaration is a rule that establishes an element's style. Declarations, which define the attributes and values to be applied to the chosen items, are encircled by curly brackets {}.
/* Selecting paragraphs to change text color and font size */
p {
color: blue;
font-size: 16px;
}
Syntax : The structure of CSS is simple—it comprises selectors and declarations. A selector identifies the HTML element you wish to style while a declaration block consists of declarations separated by semicolons. Each declaration specifies a property and its corresponding value, in the format property; value.
Selectors : Elements in an HTML page are identified by names called selectors, which allow you to access and modify them using CSS. A variety of selection types exist:
Type selectors focus on elements in HTML such as div, h1, and p.
Class selectors preceded with a period (. ), target items with certain classes.
ID selectors focus on items that have certain IDs that are preceded by a hash (#).
Declarations : A declaration is a rule that establishes an element's style. Declarations, which define the attributes and values to be applied to the chosen items, are encircled by curly brackets {}.
html/* Selecting paragraphs to change text color and font size */ p { color: blue; font-size: 16px; }
Copyrights © 2024 letsupdateskills All rights reserved