CSS Properties and Values

Pascual Vila
Frontend Instructor.
CSS (Cascading Style Sheets) relies on a simple yet powerful syntax: the property and the value. Together, they form a declaration that tells the browser how to render an element.
The Anatomy of a Declaration
A CSS declaration consists of a property name, followed by a colon (:), a value, and a semicolon (;).
Common Properties
- color: Sets the text color.
- font-size: Determines the size of the text.
- background-color: Sets the background color of the element.
- margin: Creates space around elements.
Values
Values depend on the property. color takes color names or codes (like hex or rgb). font-size takes length units like px, em, or rem.
Best Practices
Always end your declarations with a semicolon. While the last declaration in a block technically doesn't require one, omitting it is a common source of errors when you add more properties later.