Search⌘ K
AI Features

Multiple Declarations and Comments

Explore how to work with multiple CSS declarations within a rule to style elements with various properties. Understand the importance of writing comments in CSS to make your code more readable and maintainable over time. Practice by creating styles with multiple declarations and adding meaningful comments.

Multiple Declarations in CSS

In its very simple form, a CSS rule is just this:

NAME_
CSS
h1 {
background-color: red;
}

Alright, that’s fine. But you rarely define only one declaration in your code block. In a CSS rule, CODE BLOCK refers to everything between the curly braces { }.

For a basic CSS rule, you may want to "make the color of an element become white, and the background color, green. i.e have multiple ...