← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 435 · 40 questions
TalentJR

Code tip (Rule, then maths): Find the topic: syntax, selectors, properties, colours, box model, cascade, flexbox or media queries. Decide which rule or property applies to the element. For sizes, write the sum down: both sides for the box model, free space for flexbox.

NameDateTime takenScore ___ / 40
  1. 1.🌈 In #780000 the red part is the hex number 78. What is it as a normal number?
  2. 2.✍️ CSS declarations go inside which brackets? (a) [ ] (b) { } (c) ( ) (d) < >
  3. 3.⚖️ What colour is the text of this element?
    <p class="star" id="logo">Hi</p>
    CSS:
    p { color: blue; }
    p { color: green; }
    (a) yellow (b) orange (c) blue (d) green
  4. 4.What does color do? (a) centres a heading (b) makes the text bold (c) sets the letter colour (d) makes letters bigger
  5. 5.🧩 Which language reacts to a button click? (a) CSS (b) JavaScript (c) HTML
  6. 6.🌈 Which colour is #0000ff? (a) white (b) cyan (c) blue (d) yellow
  7. 7.⚖️ Two rules with the same selector set a colour. Which one wins? (a) neither (b) the later one (c) the first one (d) the shorter one
  8. 8.🧩 Which language checks a quiz answer? (a) HTML (b) JavaScript (c) CSS
  9. 9.Which of these does JavaScript do? (a) checks a quiz answer (b) makes a form box (c) makes a link (d) adds space around boxes
  10. 10.🎯 Which sign starts an id selector? (a) & (b) # (c) . (d) @
  11. 11.🎯 What kind of selector is .star? (a) an element selector (b) a class selector (c) an id selector
  12. 12.🎯 What kind of selector is .card? (a) a class selector (b) an element selector (c) an id selector
  13. 13.🎯 Which element does the selector p style? (a) <h2 class="big"> (b) <li id="top"> (c) <h1> (d) <p class="big">
  14. 14.⚖️ What colour is the text of this element?
    <p class="big" id="logo">Hi</p>
    CSS:
    #logo { color: orange; }
    .big { color: black; }
    (a) blue (b) green (c) orange (d) black
  15. 15.🖌️ What colour is behind the letters?
    li {
      font-size: 28px;
      color: red;
      background-color: white;
      text-align: right;
    }
    (a) white (b) green (c) red
  16. 16.What does justify-content: flex-end do? (a) equal gaps, none at ends (b) puts boxes in the middle (c) packs boxes at the start (d) packs boxes at the end
  17. 17.🎯 Which element does the selector #intro style? (a) <div id="intro"> (b) <div id="main"> (c) <span class="box"> (d) <div class="intro">
  18. 18.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 280px;
      justify-content: center;
    }
    Inside are 2 boxes, each 80px wide (no margins).
  19. 19.📱 Which tag helps phones show a page at the right size? (a) the br tag (b) the viewport meta tag (c) the title tag (d) the hr tag
  20. 20.⚖️ What colour is the text of this element?
    <p class="star" id="hero">Hi</p>
    CSS:
    #hero { color: blue; }
    p { color: yellow; }
    .star { color: green; }
    (a) green (b) blue (c) yellow (d) black
  21. 21.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 330px;
      justify-content: flex-start;
    }
    Inside are 3 boxes, each 100px wide (no margins).
  22. 22.⚖️ What colour is the text of this element?
    <h2 class="note" id="end">Hi</h2>
    CSS:
    .note { color: blue; }
    .note { color: yellow; }
    (a) purple (b) yellow (c) white (d) blue
  23. 23.Which of these is the content? (a) space inside the border (b) the text or picture (c) space outside the border (d) a solid or dotted edge
  24. 24.🌈 Which hex code is yellow? (a) #ff0000 (b) #000000 (c) #ffff00 (d) #ffffff
  25. 25.🔍 Which is the odd one out? (a) makes headings and lists (b) changes the text size (c) lays out the page (d) sets colours and fonts
  26. 26.True or false: JavaScript gives the page structure. (a) True (b) False
  27. 27.🖌️ How big is the text, in px?
    li {
      font-size: 20px;
      text-align: center;
      color: black;
      background-color: orange;
    }
  28. 28.✍️ How many declarations (property: value pairs) are in this rule?
    p {
      color: red;
    }
  29. 29.🔍 Which is the odd one out? (a) makes headings and lists (b) reacts to a button click (c) makes a form box (d) gives the page structure
  30. 30.🖌️ Which CSS property centres a heading? (a) font-family (b) text-align (c) font-weight (d) color
  31. 31.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 120px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 50px wide (no margins).
  32. 32.🌈 Which colour is #00ffff? (a) white (b) magenta (c) cyan (d) red
  33. 33.🌈 What is the biggest number one colour can have in rgb()? (a) 99 (b) 255 (c) 1000 (d) 100
  34. 34.🌈 In #00008d the blue part is the hex number 8d. What is it as a normal number?
  35. 35.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 6 (b) 4 (c) 3 (d) 2
  36. 36.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 20px;
      }
    }
  37. 37.🎯 Which sign starts a class selector? (a) # (b) . (c) @ (d) &
  38. 38.✍️ What is the selector in this CSS rule?
    li {
      background-color: yellow;
      font-weight: bold;
      font-style: italic;
    }
    (a) li (b) bold (c) background-color (d) body
  39. 39.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 28px;
      }
    }
  40. 40.🌈 In #rrggbb, which colour do the last two digits give? (a) green (b) white (c) blue (d) red

Answer key

  1. 120
  2. { }
  3. green
  4. sets the letter colour
  5. JavaScript
  6. blue
  7. the later one
  8. JavaScript
  9. checks a quiz answer
  10. #
  11. a class selector
  12. a class selector
  13. <p class="big">
  14. orange
  15. white
  16. packs boxes at the end
  17. <div id="intro">
  18. 60
  19. the viewport meta tag
  20. blue
  21. 30
  22. yellow
  23. the text or picture
  24. #ffff00
  25. makes headings and lists
  26. False
  27. 20
  28. 1
  29. reacts to a button click
  30. text-align
  31. 20
  32. cyan
  33. 255
  34. 141
  35. 3
  36. 16
  37. .
  38. li
  39. 24
  40. blue

Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids