← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 99 · 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.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 150px;
      padding: 10px;
      border: 3px solid black;
      margin: 0px;
    }
  2. 2.🌈 Which hex code is bright green? (a) #ffffff (b) #00ff00 (c) #0000ff (d) #00ffff
  3. 3.🧩 Which language shows a pop-up message? (a) HTML (b) JavaScript (c) CSS
  4. 4.What does justify-content: flex-start 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
  5. 5.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 90px;
      padding: 20px;
      border: 5px solid black;
      margin: 15px;
    }
  6. 6.📱 The screen is 1366px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 12px;
      }
    }
    (a) No (b) Yes
  7. 7.📱 min-width: 800px applies when the screen is ___. (a) exactly 100px (b) turned off (c) 800px or wider (d) 800px or narrower
  8. 8.🎯 Which CSS selector matches this element?
    <p class="big" id="top">Hello</p>
    (a) #big (b) #top (c) h1 (d) .top
  9. 9.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 120px;
      justify-content: center;
    }
    Inside are 2 boxes, each 40px wide (no margins).
  10. 10.📱 The screen is 820px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 30px;
      }
    }
    (a) No (b) Yes
  11. 11.🎯 Which CSS selector matches this element?
    <span class="menu" id="intro">Hello</span>
    (a) #menu (b) .intro (c) p (d) #intro
  12. 12.Which of these does HTML do? (a) counts down a timer (b) gives the page structure (c) adds space around boxes (d) sets colours and fonts
  13. 13.🧩 Which language rounds box corners? (a) JavaScript (b) HTML (c) CSS
  14. 14.What does font-family do? (a) makes the text bold (b) makes letters bigger (c) picks the font style (d) colours behind the text
  15. 15.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 260px;
      justify-content: center;
    }
    Inside are 4 boxes, each 60px wide (no margins).
  16. 16.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 12px;
      }
    }
  17. 17.⚖️ What colour is the text of this element?
    <p class="star" id="hero">Hi</p>
    CSS:
    .star { color: white; }
    p { color: green; }
    #hero { color: purple; }
    (a) purple (b) white (c) black (d) green
  18. 18.🖌️ Which CSS property sets the letter colour? (a) color (b) font-family (c) background-color (d) font-size
  19. 19.💪 Which flexbox property spaces boxes along a row? (a) flex-direction (b) align-items (c) gap (d) justify-content
  20. 20.💪 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 50px wide (no margins).
  21. 21.🎯 Which CSS selector matches this element?
    <li class="star" id="hero">Hello</li>
    (a) .hero (b) #hero (c) #star (d) div
  22. 22.🎨 What does CSS stand for? (a) Colourful Site Styles (b) Creative Sheet System (c) Cascading Style Sheets (d) Computer Style Sheets
  23. 23.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 190px;
      padding: 10px;
      border: 4px solid black;
      margin: 20px;
    }
  24. 24.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 8px;
      }
    }
  25. 25.🎯 Which sign starts a class selector? (a) @ (b) # (c) & (d) .
  26. 26.🌈 Which colour is rgb(0, 255, 0)? (a) bright green (b) black (c) white (d) red
  27. 27.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 2 (b) 4 (c) 3 (d) 6
  28. 28.🎯 Which element does the selector h1 style? (a) <div id="end"> (b) <h2> (c) <h1 class="note"> (d) <li class="note">
  29. 29.True or false: the content is the gap to other boxes. (a) True (b) False
  30. 30.🖌️ Which CSS property colours behind the text? (a) font-family (b) background-color (c) font-size (d) font-weight
  31. 31.🖌️ What colour is behind the letters?
    li {
      text-align: center;
      background-color: yellow;
      font-size: 40px;
      color: green;
    }
    (a) black (b) green (c) yellow
  32. 32.True or false: CSS rounds box corners. (a) True (b) False
  33. 33.✍️ CSS declarations go inside which brackets? (a) [ ] (b) { } (c) < > (d) ( )
  34. 34.⚖️ Which selector is the strongest? (a) a class selector (b) an id selector (c) an element selector
  35. 35.✍️ How does a CSS comment start? (a) /* (b) <!-- (c) # (d) //
  36. 36.🎯 Which element does the selector .star style? (a) <li id="star"> (b) <div class="note"> (c) <li class="star"> (d) <li class="menu">
  37. 37.🌈 Which hex code is blue? (a) #00ff00 (b) #0000ff (c) #ffffff (d) #ffff00
  38. 38.🎯 Which CSS selector matches this element?
    <div class="red" id="intro">Hello</div>
    (a) .box (b) #intro (c) #red (d) #main
  39. 39.🖌️ What colour are the letters?
    p {
      text-align: left;
      font-size: 32px;
      color: green;
      background-color: black;
    }
    (a) yellow (b) green (c) black
  40. 40.⚖️ What colour is the text of this element?
    <p class="menu" id="top">Hi</p>
    CSS:
    p { color: green; }
    p { color: blue; }
    (a) red (b) purple (c) green (d) blue

Answer key

  1. 176
  2. #00ff00
  3. JavaScript
  4. packs boxes at the start
  5. 170
  6. No
  7. 800px or wider
  8. #top
  9. 20
  10. Yes
  11. #intro
  12. gives the page structure
  13. CSS
  14. picks the font style
  15. 10
  16. 16
  17. purple
  18. color
  19. justify-content
  20. 50
  21. #hero
  22. Cascading Style Sheets
  23. 258
  24. 8
  25. .
  26. bright green
  27. 3
  28. <h1 class="note">
  29. False
  30. background-color
  31. yellow
  32. True
  33. { }
  34. an id selector
  35. /*
  36. <li class="star">
  37. #0000ff
  38. #intro
  39. green
  40. blue

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