← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 150 · 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 language changes the text size? (a) HTML (b) CSS (c) JavaScript
  2. 2.⚖️ What colour is the text of this element?
    <p class="note" id="top">Hi</p>
    CSS:
    p { color: red; }
    p { color: purple; }
    (a) green (b) red (c) black (d) purple
  3. 3.✍️ Which property is set to red in this rule?
    .note {
      margin: 10px;
      color: red;
    }
    (a) font-size (b) text-align (c) color (d) red
  4. 4.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 200px;
      padding: 20px;
      border: 3px solid black;
      margin: 15px;
    }
  5. 5.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 240px;
      justify-content: space-between;
    }
    Inside are 3 boxes, each 40px wide (no margins).
  6. 6.⚖️ What colour is the text of this element?
    <h1 class="box" id="top">Hi</h1>
    CSS:
    h1 { color: white; }
    #top { color: blue; }
    .box { color: purple; }
    (a) purple (b) white (c) black (d) blue
  7. 7.✍️ How many declarations (property: value pairs) are in this rule?
    .box {
      width: 300px;
      margin: 10px;
      text-align: center;
      padding: 8px;
    }
  8. 8.⚖️ Which selector is the weakest? (a) an id selector (b) a class selector (c) an element selector
  9. 9.✍️ What is the selector in this CSS rule?
    .box {
      width: 300px;
      background-color: yellow;
    }
    (a) width (b) h2 (c) .box (d) yellow
  10. 10.🔍 Which is the odd one out? (a) makes a link (b) makes a form box (c) puts a picture on a page (d) lays out the page
  11. 11.💪 Which justify-content value packs boxes at the end? (a) space-between (b) flex-start (c) center (d) flex-end
  12. 12.✍️ How many declarations (property: value pairs) are in this rule?
    h1 {
      font-size: 20px;
      border: 2px solid;
    }
  13. 13.💪 Which justify-content value puts boxes in the middle? (a) flex-start (b) flex-end (c) center (d) space-between
  14. 14.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 220px;
      justify-content: flex-start;
    }
    Inside are 3 boxes, each 50px wide (no margins).
  15. 15.⚖️ What colour is the text of this element?
    <p class="big" id="end">Hi</p>
    CSS:
    p { color: green; }
    #end { color: red; }
    .big { color: white; }
    (a) green (b) blue (c) white (d) red
  16. 16.📦 In the box model, which part is space inside the border? (a) padding (b) content (c) border (d) margin
  17. 17.🎯 Which element does the selector .box style? (a) <div id="box"> (b) <div class="star"> (c) <div class="box"> (d) <span class="menu">
  18. 18.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 220px;
      justify-content: space-between;
    }
    Inside are 3 boxes, each 40px wide (no margins).
  19. 19.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 70px;
      padding: 30px;
      border: 5px solid black;
      margin: 15px;
    }
  20. 20.True or false: CSS makes a form box. (a) True (b) False
  21. 21.🖌️ What colour are the letters?
    li {
      text-align: right;
      background-color: green;
      color: yellow;
      font-size: 24px;
    }
    (a) yellow (b) red (c) green
  22. 22.✍️ What value is given to background-color in this rule?
    #top {
      margin: 10px;
      font-style: italic;
      background-color: yellow;
      text-align: center;
    }
    (a) 8px (b) yellow (c) 10px (d) background-color
  23. 23.True or false: .menu is an id selector. (a) True (b) False
  24. 24.✍️ Which property is set to 20px in this rule?
    .note {
      font-size: 20px;
      color: red;
      padding: 8px;
    }
    (a) text-align (b) background-color (c) 20px (d) font-size
  25. 25.Which of these is margin? (a) a solid or dotted edge (b) space inside the border (c) the text or picture (d) the gap to other boxes
  26. 26.🖌️ What colour are the letters?
    h1 {
      background-color: black;
      text-align: center;
      color: yellow;
      font-size: 16px;
    }
    (a) yellow (b) white (c) black
  27. 27.📱 What does a media query check? (a) the page title (b) the time of day (c) the battery level (d) the screen width
  28. 28.⚖️ What colour is the text of this element?
    <h1 class="box" id="top">Hi</h1>
    CSS:
    #top { color: blue; }
    #top { color: white; }
    (a) green (b) black (c) blue (d) white
  29. 29.🧩 Which language makes a form box? (a) CSS (b) JavaScript (c) HTML
  30. 30.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 150px;
      padding: 5px;
      border: 2px solid black;
      margin: 20px;
    }
  31. 31.⚖️ Which selector is the strongest? (a) an element selector (b) a class selector (c) an id selector
  32. 32.True or false: the border is the gap to other boxes. (a) True (b) False
  33. 33.🎯 How many elements on a page should have the same id? (a) 2 (b) 5 (c) any number (d) 1
  34. 34.🎯 Which CSS selector matches this element?
    <li class="menu" id="logo">Hello</li>
    (a) .logo (b) #end (c) #menu (d) #logo
  35. 35.True or false: p is an element selector. (a) False (b) True
  36. 36.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 150px;
      justify-content: flex-end;
    }
    Inside are 2 boxes, each 60px wide (no margins).
  37. 37.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 160px;
      padding: 10px;
      border: 1px solid black;
      margin: 15px;
    }
  38. 38.What does font-weight do? (a) picks the font style (b) colours behind the text (c) makes letters bigger (d) makes the text bold
  39. 39.🌈 Which colour of light is strongest in rgb(52, 252, 44)? (a) red (b) green (c) blue
  40. 40.Which of these does CSS do? (a) makes a link (b) makes a form box (c) lays out the page (d) puts a picture on a page

Answer key

  1. CSS
  2. purple
  3. color
  4. 246
  5. 60
  6. blue
  7. 4
  8. an element selector
  9. .box
  10. lays out the page
  11. flex-end
  12. 2
  13. center
  14. 70
  15. red
  16. padding
  17. <div class="box">
  18. 50
  19. 170
  20. False
  21. yellow
  22. yellow
  23. False
  24. font-size
  25. the gap to other boxes
  26. yellow
  27. the screen width
  28. white
  29. HTML
  30. 204
  31. an id selector
  32. False
  33. 1
  34. #logo
  35. True
  36. 30
  37. 182
  38. makes the text bold
  39. green
  40. lays out the page

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