Lecture

Basic Structure of CSS

Basic Structure: Selectors, Properties, Values

CSS is structured as shown below.

Basic Structure of CSS
selector { property: value; }

Just like a printer prints colors at specified coordinates, CSS defines rules for which HTML element (selector) should be styled in what way (property) and how (value).

  • Selector: Chooses the HTML element to style

  • Property and Value: Defines what property (e.g., color, font size) and how to apply it (e.g., red, 16px) to the chosen element

For instance, to apply red color to an h1 tag as defined above, you would write the CSS like this.

CSS
h1 { color: red; }

Here, h1 is the selector, color is the property, and red is the value.

Always end the value with a semicolon (;). This signifies the end of that line.

Mission
0 / 1

How is the basic structure of CSS organized?

CSS consists of .
selectors, properties, values
tags, properties, values
selectors, values, properties
tags, selectors, values

Lecture

AI Tutor

Publish

Design

Upload

Notes

Favorites

Help