CSS Syntax and Declarations
A declaration consists of a property followed by a colon and a value. Multiple declarations are enclosed inside braces. CSS allows comments using /* ... */.
Values may be keywords, numbers, lengths, percentages, colors, functions, or compound expressions.
CSS Rule Anatomy
CSS Declaration Syntax
/* Card styling */
.card {
width: 320px;
padding: 24px;
background-color: white;
border-radius: 12px;
box-shadow: 0 10px 30px rgb(0 0 0 / 0.12);
}💡 Each property-value pair forms a declaration. CSS functions such as
rgb() can also be used to express values.Key Takeaways
- Property names and values form declarations.
- CSS supports functions such as
rgb(),calc(),min(),max(), andclamp().
Knowledge Check
Which part of `color: blue` is the property?