← CSS Styling
CSS foundations · 15 MIN

How CSS works

How CSS works

A CSS rule contains a selector and a declaration block. Each declaration has a property and value. Browsers combine author styles, user preferences, specificity, inheritance and source order in the cascade to determine the final presentation.

Try it yourself

Change the example, run it, and explain the result in your own words. Then create one variation of your own.

Key idea

Use the example as a starting point, not something to memorize. Practise, inspect the result and make small improvements.

Code example

h1 {
  color: #243b53;
  font-size: 2rem;
}