← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 90 · 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.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 22px;
      }
    }
  2. 2.Which of these is the border? (a) the gap round content (b) space inside the border (c) the text or picture (d) the line round the box
  3. 3.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 6px;
      }
    }
  4. 4.🧩 Which language makes a form box? (a) CSS (b) HTML (c) JavaScript
  5. 5.💪 Which flexbox property picks row or column? (a) align-items (b) justify-content (c) gap (d) flex-direction
  6. 6.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 170px;
      justify-content: space-between;
    }
    Inside are 2 boxes, each 60px wide (no margins).
  7. 7.⚖️ What colour is the text of this element?
    <h1 class="menu" id="main">Hi</h1>
    CSS:
    #main { color: orange; }
    #main { color: red; }
    (a) orange (b) white (c) blue (d) red
  8. 8.📱 min-width: 800px applies when the screen is ___. (a) 800px or wider (b) 800px or narrower (c) exactly 100px (d) turned off
  9. 9.🌈 Which colour is #ff00ff? (a) red (b) magenta (c) black (d) cyan
  10. 10.✍️ What value is given to font-style in this rule?
    .box {
      border: 2px solid;
      text-align: center;
      font-style: italic;
    }
    (a) 20px (b) red (c) italic (d) font-style
  11. 11.✍️ What is the selector in this CSS rule?
    body {
      font-style: italic;
      padding: 8px;
    }
    (a) body (b) 8px (c) .box (d) font-style
  12. 12.⚖️ Which selector is the weakest? (a) an id selector (b) a class selector (c) an element selector
  13. 13.✍️ What is the selector in this CSS rule?
    body {
      padding: 8px;
      text-align: center;
      margin: 10px;
      background-color: yellow;
    }
    (a) center (b) body (c) padding (d) .box
  14. 14.🌈 What is the biggest number one colour can have in rgb()? (a) 99 (b) 255 (c) 100 (d) 1000
  15. 15.✍️ Which property is set to center in this rule?
    li {
      font-size: 20px;
      width: 300px;
      text-align: center;
    }
    (a) margin (b) background-color (c) text-align (d) center
  16. 16.💪 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).
  17. 17.⚖️ What colour is the text of this element?
    <p class="box" id="intro">Hi</p>
    CSS:
    #intro { color: yellow; }
    #intro { color: white; }
    (a) red (b) green (c) white (d) yellow
  18. 18.🖌️ How big is the text, in px?
    p {
      background-color: purple;
      text-align: left;
      font-size: 16px;
      color: white;
    }
  19. 19.🎨 Which tag holds CSS inside the head? (a) <style> (b) <script> (c) <css> (d) <body>
  20. 20.✍️ What is the selector in this CSS rule?
    #top {
      background-color: yellow;
      font-weight: bold;
      margin: 10px;
    }
    (a) bold (b) #top (c) background-color (d) li
  21. 21.🎯 Which CSS selector matches this element?
    <p class="big" id="main">Hello</p>
    (a) .main (b) h1 (c) .red (d) #main
  22. 22.🖌️ What colour is behind the letters?
    p {
      background-color: blue;
      color: red;
      text-align: center;
      font-size: 16px;
    }
    (a) orange (b) blue (c) red
  23. 23.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the shorter one (b) neither (c) the first one (d) the later one
  24. 24.🌈 Which colour is #ffffff? (a) bright green (b) white (c) black (d) blue
  25. 25.🎯 Which sign starts a class selector? (a) & (b) # (c) @ (d) .
  26. 26.🔍 Which is the odd one out? (a) lays out the page (b) sets colours and fonts (c) makes a form box (d) changes the text size
  27. 27.✍️ What is the selector in this CSS rule?
    h1 {
      color: red;
      font-style: italic;
    }
    (a) color (b) h1 (c) p (d) italic
  28. 28.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 250px;
      justify-content: flex-start;
    }
    Inside are 3 boxes, each 60px wide (no margins).
  29. 29.✍️ In color: blue; which part is the value? (a) blue (b) ; (c) : (d) color
  30. 30.🧩 Which language sets colours and fonts? (a) HTML (b) CSS (c) JavaScript
  31. 31.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 250px;
      padding: 25px;
      border: 4px solid black;
      margin: 15px;
    }
  32. 32.🎯 Which element does the selector span style? (a) <span class="big"> (b) <h1 class="big"> (c) <p> (d) <h2 id="hero">
  33. 33.🧩 Which language counts down a timer? (a) HTML (b) JavaScript (c) CSS
  34. 34.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 90px;
      padding: 20px;
      border: 3px solid black;
      margin: 5px;
    }
  35. 35.✍️ How many declarations (property: value pairs) are in this rule?
    body {
      margin: 10px;
      color: red;
      font-size: 20px;
    }
  36. 36.🌈 Hex digits go 0 to 9, then A to which letter? (a) G (b) J (c) Z (d) F
  37. 37.✍️ How many declarations (property: value pairs) are in this rule?
    p {
      padding: 8px;
    }
  38. 38.✍️ How many declarations (property: value pairs) are in this rule?
    li {
      font-style: italic;
      margin: 10px;
      width: 300px;
      padding: 8px;
    }
  39. 39.Which of these is padding? (a) the line round the box (b) space inside the border (c) a solid or dotted edge (d) the gap to other boxes
  40. 40.🖌️ How big is the text, in px?
    li {
      font-size: 28px;
      color: black;
      background-color: blue;
      text-align: right;
    }

Answer key

  1. 22
  2. the line round the box
  3. 6
  4. HTML
  5. flex-direction
  6. 50
  7. red
  8. 800px or wider
  9. magenta
  10. italic
  11. body
  12. an element selector
  13. body
  14. 255
  15. text-align
  16. 50
  17. white
  18. 16
  19. <style>
  20. #top
  21. #main
  22. blue
  23. the later one
  24. white
  25. .
  26. makes a form box
  27. h1
  28. 70
  29. blue
  30. CSS
  31. 308
  32. <span class="big">
  33. JavaScript
  34. 146
  35. 3
  36. F
  37. 1
  38. 4
  39. space inside the border
  40. 28

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