Ans:
Ans:
Ans:
Ans:
Ans:
Ans:
Ans:
Ans:
Ans:
Ans:
Ans:
Ans:
Ans:
Ans:
Ans:
Ans:
Ans:
Ans:
Ans:
Ans:
A CSS rule is made of two main parts: a selector and a declaration block, written as selector { property: value; }.
A CSS selector specifies which HTML element you want to style.
The two main parts of a CSS declaration block are property and value.
Each declaration ends with a semicolon to separate it from other declarations within the block.
p { color: blue; font-size: 18px; }
'h1' is an element selector (tag selector) that targets all <h1> HTML elements.
It selects all paragraph (<p>) elements in the HTML document to apply the specified styles.
h1 { color: green; }
Curly braces enclose the declaration block, which contains one or more property-value pairs.
Property is the style attribute you want to change (like color), and value is how you want to change it (like red).
Correct CSS syntax ensures styles are applied properly, prevents errors in webpage formatting, and keeps the code clean and readable.
Property is 'font-size' and value is '20px'.
p { text-align: center; }
A colon (:) separates the property from its value.
body { background-color: lightyellow; }
The selector 'p' selects all paragraph elements to apply the style 'color: blue;'.
The semicolon indicates the end of a declaration and separates multiple declarations within a declaration block.
Yes, multiple properties are written inside the curly braces, each with its property:value; pair separated by semicolons.
h2 { color: red; font-family: Arial; font-size: 20px; }
Forgetting the closing curly brace will cause CSS parsing errors, and the styles may not be applied properly or at all.