← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 889 · 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.🎨 What does CSS stand for? (a) Creative Sheet System (b) Cascading Style Sheets (c) Colourful Site Styles (d) Computer Style Sheets
  2. 2.🧩 Which language shows a pop-up message? (a) CSS (b) JavaScript (c) HTML
  3. 3.🔍 Which is the odd one out? (a) gives the page structure (b) lays out the page (c) sets colours and fonts (d) changes the text size
  4. 4.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 20px;
      }
    }
  5. 5.Which of these does JavaScript do? (a) shows a pop-up message (b) lays out the page (c) sets colours and fonts (d) adds space around boxes
  6. 6.🔍 Which is the odd one out? (a) shows a pop-up message (b) counts down a timer (c) checks a quiz answer (d) makes a form box
  7. 7.What does justify-content: center do? (a) puts boxes in the middle (b) packs boxes at the end (c) equal gaps, none at ends (d) packs boxes at the start
  8. 8.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 18px;
      }
    }
  9. 9.🎯 Which element does the selector #hero style? (a) <span id="top"> (b) <span id="hero"> (c) <p class="menu"> (d) <span class="hero">
  10. 10.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 260px;
      padding: 10px;
      border: 4px solid black;
      margin: 15px;
    }
  11. 11.True or false: padding is space outside the border. (a) True (b) False
  12. 12.⚖️ What colour is the text of this element?
    <h1 class="big" id="top">Hi</h1>
    CSS:
    h1 { color: blue; }
    #top { color: green; }
    .big { color: black; }
    (a) red (b) black (c) green (d) blue
  13. 13.🌈 Which colour of light is strongest in rgb(249, 50, 66)? (a) green (b) blue (c) red
  14. 14.Which of these does HTML do? (a) reacts to a button click (b) puts a picture on a page (c) checks a quiz answer (d) counts down a timer
  15. 15.🎯 Which CSS selector matches this element?
    <li class="red" id="top">Hello</li>
    (a) #red (b) .box (c) li (d) #intro
  16. 16.🎯 Which element does the selector .note style? (a) <h1 id="note"> (b) <h2 class="red"> (c) <h1 class="note"> (d) <h1 class="big">
  17. 17.🎯 What kind of selector is img? (a) a class selector (b) an id selector (c) an element selector
  18. 18.True or false: JavaScript adds space around boxes. (a) True (b) False
  19. 19.📱 min-width: 800px applies when the screen is ___. (a) turned off (b) exactly 100px (c) 800px or wider (d) 800px or narrower
  20. 20.🖌️ Where does the text sit on its line?
    h2 {
      background-color: green;
      color: yellow;
      text-align: left;
      font-size: 16px;
    }
    (a) on the left (b) in the middle (c) on the right
  21. 21.💪 Which flexbox property sets space between boxes? (a) gap (b) flex-direction (c) justify-content (d) display: flex
  22. 22.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 280px;
      padding: 10px;
      border: 5px solid black;
      margin: 15px;
    }
  23. 23.🖌️ How big is the text, in px?
    p {
      color: yellow;
      background-color: green;
      font-size: 32px;
      text-align: left;
    }
  24. 24.💪 Which justify-content value puts boxes in the middle? (a) flex-end (b) space-between (c) center (d) flex-start
  25. 25.🎯 Which CSS selector matches this element?
    <span class="star" id="logo">Hello</span>
    (a) .menu (b) #logo (c) .logo (d) #end
  26. 26.🎯 Which element does the selector #main style? (a) <p class="main"> (b) <p id="logo"> (c) <h1 class="menu"> (d) <p id="main">
  27. 27.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 16px;
      }
    }
  28. 28.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 120px;
      justify-content: space-between;
    }
    Inside are 2 boxes, each 50px wide (no margins).
  29. 29.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the later one (b) neither (c) the first one (d) the shorter one
  30. 30.💪 Which flexbox property picks row or column? (a) align-items (b) display: flex (c) flex-direction (d) justify-content
  31. 31.🎯 What kind of selector is #end? (a) a class selector (b) an id selector (c) an element selector
  32. 32.🌈 Which colour is #ffffff? (a) white (b) bright green (c) blue (d) magenta
  33. 33.What does justify-content: flex-start do? (a) equal gaps, none at ends (b) puts boxes in the middle (c) packs boxes at the end (d) packs boxes at the start
  34. 34.⚖️ Which selector is the weakest? (a) a class selector (b) an element selector (c) an id selector
  35. 35.🎯 Which CSS selector matches this element?
    <span class="star" id="intro">Hello</span>
    (a) #star (b) #intro (c) #main (d) p
  36. 36.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 2 (b) 3 (c) 6 (d) 4
  37. 37.🧩 Which language checks a quiz answer? (a) HTML (b) JavaScript (c) CSS
  38. 38.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 10px;
      }
    }
  39. 39.🌈 Which colour is rgb(255, 255, 0)? (a) cyan (b) white (c) yellow (d) bright green
  40. 40.🎯 Which CSS selector matches this element?
    <span class="note" id="main">Hello</span>
    (a) #logo (b) span (c) p (d) .main

Answer key

  1. Cascading Style Sheets
  2. JavaScript
  3. gives the page structure
  4. 20
  5. shows a pop-up message
  6. makes a form box
  7. puts boxes in the middle
  8. 18
  9. <span id="hero">
  10. 288
  11. False
  12. green
  13. red
  14. puts a picture on a page
  15. li
  16. <h1 class="note">
  17. an element selector
  18. False
  19. 800px or wider
  20. on the left
  21. gap
  22. 310
  23. 32
  24. center
  25. #logo
  26. <p id="main">
  27. 16
  28. 20
  29. the later one
  30. flex-direction
  31. an id selector
  32. white
  33. packs boxes at the start
  34. an element selector
  35. #intro
  36. 3
  37. JavaScript
  38. 10
  39. yellow
  40. span

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