Web developmentLesson 1 of 2 in the course HTML and CSS

CSS Foundations: Selectors, Cascade, Layout, and Standards

5 flashcards · 5 quiz questions · 5 match pairs · 5 fill-in sentences · English

Lesson progress
0 / 5

Your progress is kept in this browser only.Sign up to save it

Summary

CSS controls the presentation of documents such as HTML pages. This lesson introduces the purpose of CSS, its basic rule structure, and the selectors that determine which elements receive styles.

Cascading Style Sheets (CSS) is a style sheet language used to specify the presentation of markup documents, including HTML, XML, SVG, and XHTML. Together with HTML and JavaScript, it is a cornerstone technology of the Web.

All flashcards

What is CSS?
CSS, or Cascading Style Sheets, is a language for specifying the presentation of markup documents, including their colors, fonts, spacing, and layout.
What are the parts of a basic CSS rule?
A CSS rule consists of a selector and a declaration block enclosed in braces. The block contains one or more declarations.
How do class and ID selectors differ?
A class selector begins with a dot and can match multiple elements. An ID selector begins with a hash and targets an element whose ID is intended to be unique within its document.
How do pseudo-classes differ from pseudo-elements?
Pseudo-classes select elements according to a state or other contextual information and use single-colon notation. Pseudo-elements select a part of an element and conventionally use double-colon notation.
Why use an external stylesheet?
An external stylesheet lets multiple pages share presentation rules, reduces repeated style definitions, makes site-wide changes easier, and may be cached by the browser.

Quiz questions

  1. What is the primary purpose of CSS?Answer: To specify the presentation of a markup document.
  2. Which part of a CSS rule identifies the elements to which the rule applies?Answer: The selector.
  3. In `h1 { color: red; }`, what role does `red` play?Answer: It is the value of the `color` property.
  4. Which selector targets elements with the class name `notice`?Answer: .notice
  5. What does the selector `div .myClass` target?Answer: Elements with class `myClass` that are descendants of a `div`.

Based on the Wikipedia article CSS, licensed CC BY-SA 4.0. Adapted into a summary, flashcards and quizzes.

All Web development lessons