Element (type) selectors, online

Six activities your students do on their own devices. See who's finished, and their scores.

Element (type) selectors in one minute

What students need to know

'a' is the HTML tag name used directly as a CSS selector. No dot or hash prefix — that's the element selector pattern. This p rule can be overridden by a .intro { color: red } class rule or a #lead { color: green } ID rule.

Element selectors are global — they apply to every element of that type on the page, not just the first one. Element selectors have the lowest specificity. Class selectors (0,1,0) and ID selectors (1,0,0) override them.

Mistakes students make

  • CSS element selectors should be lowercase. 'P' should be written as 'p'.
  • CSS property-value pairs require a colon separator. It should be color: red; not color red;.
  • CSS property-value pairs require a colon separator. It should be text-decoration: none; not text-decoration none;.
  • CSS property-value pairs require a colon separator. It should be color: blue; not color blue;.
PREVIOUS · MODULE 34CSS rule syntax
YOU ARE HERE · MODULE 35Element (type) selectors
NEXT · MODULE 36Class selectors

Discover other journeys with this module

What students will learn in this module

Every question in Module 35

Quick questions

  1. What syntax does an element selector use?AThe lowercase HTML tag name: p, h1, aBA dot followed by the tag name: .p, .h1
  2. What does p { color: blue; } target?AEvery <p> element on the pageBOnly the first <p> element
  3. True or false: element selectors are the most specific type of CSS selector.ATrueBFalse
  4. Which is the correct CSS syntax for an element selector?Ah1: { font-size: 2em; }Bh1 { font-size: 2em; }
  5. True or false: a { text-decoration: none; } removes the underline from all links.ATrueBFalse

Key terms

Students type the meaning of:

  • p { }

Match the pairs

p { color: red; }Match it to what it does
h1 {
  font-size: 2em;
  color: darkblue;
}
Match it to what it does
An element selector uses the lowercase HTML tag name with no prefixMatch it to what it does
Element selectors are the least specific — class and id selectors override themMatch it to what it does
P { color: red; }Match it to what it does
p { color red; }Match it to what it does

Fill in the blanks

  1. _ { color: red; }

    Hint: Type the HTML element name used as a CSS selector to style all paragraphs

  2. __ { font-size: 32px; }

    Hint: Type the HTML element name used as a CSS selector to style all level-1 headings

  3. p { _____: navy; }

    Hint: Type the CSS property name that sets the text colour of an element

  4. _ { text-decoration: none; }

    Hint: Type the HTML element name used as a CSS selector to style all links

  5. __ { list-style: none; }

    Hint: Type the HTML element name used as a CSS selector to style all unordered lists

Spot the error

Question 1

AP { color: red; }Bh2 { font-size: 24px; }Ca { text-decoration: none; }

Question 2

Ap { color: blue; }Bh1 { color red; }Ca { color: green; }

Question 3

Ap { color: navy; }Bh2 { font-weight: bold; }Ca { text-decoration none; }

Question 4

Ap { color: red; }Bh1 { font-size: 32px; }Cul { list-style: disc; }Dli { color blue; }

Question 5

Ap { margin: 0; }Bh2 { color: navy; }Cul { padding: 0; }Dli { list-style: none; }Ea { color red; }