← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 938 · 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.🖌️ Which CSS property picks the font style? (a) font-size (b) color (c) font-family (d) background-color
  2. 2.📱 max-width: 600px applies when the screen is ___. (a) exactly 1000px (b) 600px or wider (c) 600px or narrower (d) turned off
  3. 3.🧩 Which language shows a pop-up message? (a) JavaScript (b) CSS (c) HTML
  4. 4.🎯 What kind of selector is .card? (a) a class selector (b) an element selector (c) an id selector
  5. 5.🌈 Which hex code is bright green? (a) #ff00ff (b) #00ff00 (c) #ff0000 (d) #000000
  6. 6.🌈 Which colour of light is strongest in rgb(76, 250, 106)? (a) red (b) green (c) blue
  7. 7.🧩 Which language reacts to a button click? (a) HTML (b) JavaScript (c) CSS
  8. 8.🎯 Which element does the selector .note style? (a) <span class="big"> (b) <span id="note"> (c) <p class="red"> (d) <span class="note">
  9. 9.⚖️ What colour is the text of this element?
    <h2 class="big" id="intro">Hi</h2>
    CSS:
    .big { color: orange; }
    #intro { color: blue; }
    (a) orange (b) blue (c) black (d) red
  10. 10.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 150px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 40px wide (no margins).
  11. 11.🎯 Which CSS selector matches this element?
    <h1 class="note" id="main">Hello</h1>
    (a) .big (b) #note (c) h2 (d) #main
  12. 12.🧩 Which language rounds box corners? (a) HTML (b) JavaScript (c) CSS
  13. 13.🎯 Which CSS selector matches this element?
    <h2 class="menu" id="end">Hello</h2>
    (a) .end (b) #end (c) #hero (d) li
  14. 14.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the later one (b) the shorter one (c) neither (d) the first one
  15. 15.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 100px;
      padding: 30px;
      border: 5px solid black;
      margin: 5px;
    }
  16. 16.🌈 Which hex code is black? (a) #00ffff (b) #ff0000 (c) #0000ff (d) #000000
  17. 17.True or false: CSS lays out the page. (a) False (b) True
  18. 18.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 300px;
      justify-content: flex-end;
    }
    Inside are 4 boxes, each 60px wide (no margins).
  19. 19.🧩 Which language counts down a timer? (a) JavaScript (b) HTML (c) CSS
  20. 20.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 20px;
      }
    }
  21. 21.🎯 Which sign starts a class selector? (a) @ (b) # (c) . (d) &
  22. 22.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 70px;
      padding: 15px;
      border: 5px solid black;
      margin: 10px;
    }
  23. 23.🎯 Which element does the selector #top style? (a) <span class="top"> (b) <span id="top"> (c) <p class="note"> (d) <span id="intro">
  24. 24.⚖️ What colour is the text of this element?
    <h1 class="menu" id="intro">Hi</h1>
    CSS:
    h1 { color: black; }
    .menu { color: purple; }
    #intro { color: green; }
    (a) black (b) purple (c) blue (d) green
  25. 25.✍️ CSS declarations go inside which brackets? (a) ( ) (b) < > (c) { } (d) [ ]
  26. 26.📱 The screen is 1366px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 8px;
      }
    }
    (a) Yes (b) No
  27. 27.Which of these does CSS do? (a) lays out the page (b) puts a picture on a page (c) makes a form box (d) counts down a timer
  28. 28.⚖️ Which selector is the weakest? (a) an id selector (b) a class selector (c) an element selector
  29. 29.🖌️ Which CSS property colours behind the text? (a) text-align (b) font-size (c) background-color (d) color
  30. 30.What does background-color do? (a) colours behind the text (b) makes the text bold (c) sets the letter colour (d) picks the font style
  31. 31.🎯 Can many elements share the same class? (a) No (b) Yes
  32. 32.📱 The screen is 700px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 14px;
      }
    }
    (a) No (b) Yes
  33. 33.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 110px;
      justify-content: space-between;
    }
    Inside are 2 boxes, each 50px wide (no margins).
  34. 34.True or false: HTML reacts to a button click. (a) False (b) True
  35. 35.🖌️ What colour is behind the letters?
    p {
      font-size: 24px;
      background-color: black;
      color: orange;
      text-align: left;
    }
    (a) green (b) orange (c) black
  36. 36.Which of these does CSS do? (a) changes the page live (b) reacts to a button click (c) adds space around boxes (d) shows a pop-up message
  37. 37.🖌️ Which CSS property makes letters bigger? (a) text-align (b) color (c) font-size (d) font-family
  38. 38.🎨 What does CSS stand for? (a) Creative Sheet System (b) Computer Style Sheets (c) Cascading Style Sheets (d) Colourful Site Styles
  39. 39.✍️ What is the selector in this CSS rule?
    .box {
      font-size: 20px;
      text-align: center;
      margin: 10px;
      border: 2px solid;
    }
    (a) h2 (b) .box (c) font-size (d) center
  40. 40.💪 Which justify-content value packs boxes at the start? (a) center (b) flex-end (c) space-between (d) flex-start

Answer key

  1. font-family
  2. 600px or narrower
  3. JavaScript
  4. a class selector
  5. #00ff00
  6. green
  7. JavaScript
  8. <span class="note">
  9. blue
  10. 70
  11. #main
  12. CSS
  13. #end
  14. the later one
  15. 170
  16. #000000
  17. True
  18. 60
  19. JavaScript
  20. 20
  21. .
  22. 130
  23. <span id="top">
  24. green
  25. { }
  26. No
  27. lays out the page
  28. an element selector
  29. background-color
  30. colours behind the text
  31. Yes
  32. Yes
  33. 10
  34. False
  35. black
  36. adds space around boxes
  37. font-size
  38. Cascading Style Sheets
  39. .box
  40. flex-start

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