Fall 2026
  • Discord
  • Gradescope
  • Syllabus

On this page

  • HTML 1
  • Question 1
  • Question 2
  • Question 3
  • Question 4
  • Question 5
  • Question 6
  • Question 7
  • Question 8
  • Question 9
  • Question 10
  • Question 11
  • Question 12
  • HTML 2
  • Question 13
  • Question 14
  • Question 15
  • Question 16
  • Question 17
  • Question 18
  • Question 19
  • Question 20
  • Question 21
  • Question 22
  • Question 23
  • Question 24
  • Question 25
  • Question 26
  • Question 27
  • Question 28
  • Question 29
  • Question 30
  • Question 31
  • Question 32

CSS: Practice Questions

HTML 1

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <title>Summit Snack Club</title>
    </head>
    <body>
        <div id="header">
            <img src="top-image.png" alt="Sunrise over the ridge">
        </div>
        <h1 id="top">Summit <span class="bold">Snack Club</span></h1>
        <p class="bold lead">
            <span class="italic">Saturday: Switchback Ridge.</span>
            Meet before sunrise. Bring water and your finest trail mix.
        </p>
        <blockquote>
            <span class="bold">Trail rule:</span>
            Whoever says "almost there" has to carry the snacks.
        </blockquote>
        <p>
            <a href="https://www.rtealwitter.com">Meet our trip leader</a>,
            whose route descriptions include "mostly uphill."
        </p>
        <br>
        <a href="https://www.rtealwitter.com">
            <img src="bottom-image.png" alt="The club at the summit">
        </a>
    </body>
</html>

Question 1

Use the HTML 1 above.

How many HTML tags does the CSS selector p select in the page above?

Answer
2

Question 2

Use the HTML 1 above.

How many HTML tags does the CSS selector .bold select in the page above?

Answer
3

Question 3

Use the HTML 1 above.

How many HTML tags does the CSS selector p.bold select in the page above?

Answer
1

Question 4

Use the HTML 1 above.

How many HTML tags does the CSS selector p .bold select in the page above?

Answer
0

Question 5

Use the HTML 1 above.

How many HTML tags does the CSS selector p, .bold select in the page above?

Answer
4

Question 6

Use the HTML 1 above.

How many HTML tags does the CSS selector #top select in the page above?

Answer
1

Question 7

Use the HTML 1 above.

How many HTML tags does the CSS selector div#top select in the page above?

Answer
0

Question 8

Use the HTML 1 above.

How many HTML tags does the CSS selector [src="top-image.png"] select in the page above?

Answer
1

Question 9

Use the HTML 1 above.

How many HTML tags does the CSS selector [class="bold"] select in the page above?

Answer
2

Question 10

Use the HTML 1 above.

How many HTML tags does the CSS selector body span select in the page above?

Answer
3

Question 11

Use the HTML 1 above.

How many HTML tags does the CSS selector body > span select in the page above?

Answer
0

Question 12

Use the HTML 1 above.

How many HTML tags does the CSS selector h1 > span select in the page above?

Answer
1

HTML 2

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <title>Caesar's Crag Climbing Club</title>
    </head>
    <body>
        <div id="header">
            <h1 id="top">Caesar's <span class="bold">Crag</span></h1>
            <img src="top-image.png" alt="The climbing wall">
        </div>
        <div id="body">
            <h2>The Crag Report</h2>
            <p class="bold">
                Today's challenge: Caesar Salad, a route with
                suspiciously small footholds.
            </p>
            <p class="bold">
                The holds are colorful. Our excuses are more colorful.
            </p>
            <h2>Three Moves, Twelve Attempts</h2>
            <ol>
                <li>
                    <img class="bold" src="caesar.png"
                         alt="Caesar Salad route">
                </li>
                <li class="bold"><em>Find the tiny foothold.</em></li>
                <li class="bold"><em>Try the move one more time.</em></li>
                <li class="bold"><em>Celebrate with a snack.</em></li>
            </ol>
        </div>
    </body>
</html>

Question 13

Use the HTML 2 above.

How many HTML tags does the CSS selector li.bold select in the page above?

Answer
3

Question 14

Use the HTML 2 above.

How many HTML tags does the CSS selector li .bold select in the page above?

Answer
1

Question 15

Use the HTML 2 above.

How many HTML tags does the CSS selector div > .bold select in the page above?

Answer
2

Question 16

Use the HTML 2 above.

How many HTML tags does the CSS selector ol em select in the page above?

Answer
3

Question 17

Use the HTML 1 above.

How many HTML tags does the CSS selector h1 + p select in the page above?

Answer
1

Question 18

Use the HTML 1 above.

How many HTML tags does the CSS selector h1 ~ p select in the page above?

Answer
2

Question 19

Use the HTML 1 above.

How many HTML tags does the CSS selector p ~ p select in the page above?

Answer
1

Question 20

Use the HTML 1 above.

How many HTML tags does the CSS selector p + p select in the page above?

Answer
0

Question 21

Use the HTML 1 above.

How many HTML tags does the CSS selector h1 ~ p > span select in the page above?

Answer
1

Question 22

Use the HTML 2 above.

How many HTML tags does the CSS selector h2 + p select in the page above?

Answer
1

Question 23

Use the HTML 2 above.

How many HTML tags does the CSS selector img ~ li > em select in the page above?

Answer
0

Question 24

Use the HTML 2 above.

How many HTML tags does the CSS selector #header > h1 ~ * select in the page above?

Answer
1

Question 25

Use the HTML 2 above.

How many HTML tags does the CSS selector h2 ~ *, .bold select in the page above?

Answer
9

Question 26

Use the HTML 2 above.

How many HTML tags does the CSS selector div + *, h2 select in the page above?

Answer
3

Question 27

What color and font weight does this paragraph have?

<p class="alert">Trail closed</p>
.alert { color: red; font-weight: bold; }
p { color: blue; }
Answer

Red and bold. The class selector wins the color conflict; the later color declaration does not replace the separate font-weight declaration.

Question 28

What color does this heading have? Explain which rule decides it.

<h2 id="hours" class="notice">Hours</h2>
#hours { color: green; }
.notice { color: orange; }
#hours { color: purple; }
Answer

Purple. The two ID selectors outrank the class selector and tie with each other, so the later ID rule wins.

Question 29

What color is each word?

<section><p>Open <span>today</span></p></section>
section { color: green; }
p { color: navy; }
Answer

Both “Open” and “today” are navy. The paragraph has its own color, so it does not inherit green. The span has no color declaration and inherits navy from the paragraph.

Question 30

A card has the styles below. Its text is too close to its border, but the gap between cards is already right. Which property should you increase? Which should you leave alone?

.card { padding: 4px; border: 1px solid black; margin: 20px; }
Answer

Increase padding to move the text away from the border. Leave margin alone because it controls the space outside the border, between cards.

Question 31

Describe the link’s text color and background before the pointer reaches it and while the pointer is over it.

a { color: navy; background-color: white; }
a:hover { background-color: yellow; }
Answer

Before hovering: navy text on white. While hovering: navy text on yellow. The hover rule changes only the background color.

Question 32

What paragraph margin applies at browser widths of 500, 600, and 800 CSS pixels?

p { margin: 24px; }
@media (max-width: 600px) {
    p { margin: 8px; }
}
Answer

500 pixels: 8px. 600 pixels: 8px. 800 pixels: 24px. The max-width condition includes 600; when it holds, the later paragraph rule wins.