← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 837 · 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 many declarations (property: value pairs) are in this rule?
    h1 {
      border: 2px solid;
    }
  2. 2.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 360px;
      justify-content: center;
    }
    Inside are 2 boxes, each 100px wide (no margins).
  3. 3.✍️ What value is given to color in this rule?
    h1 {
      width: 300px;
      color: red;
      font-style: italic;
    }
    (a) color (b) 20px (c) center (d) red
  4. 4.✍️ What value is given to text-align in this rule?
    #top {
      text-align: center;
      margin: 10px;
      font-size: 20px;
    }
    (a) center (b) 10px (c) text-align (d) yellow
  5. 5.✍️ Which sign ends each CSS declaration? (a) , (b) ; (c) . (d) :
  6. 6.💪 Which flexbox property picks row or column? (a) gap (b) align-items (c) flex-direction (d) justify-content
  7. 7.🎯 Which CSS selector matches this element?
    <h1 class="star" id="logo">Hello</h1>
    (a) .logo (b) #end (c) #star (d) #logo
  8. 8.📦 In the box model, which part is the line round the box? (a) border (b) padding (c) content (d) margin
  9. 9.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 290px;
      justify-content: space-between;
    }
    Inside are 3 boxes, each 50px wide (no margins).
  10. 10.⚖️ What colour is the text of this element?
    <p class="big" id="top">Hi</p>
    CSS:
    .big { color: white; }
    .big { color: orange; }
    (a) orange (b) green (c) purple (d) white
  11. 11.📦 In the box model, which part is space inside the border? (a) border (b) padding (c) margin (d) content
  12. 12.What does text-align do? (a) picks the font style (b) centres a heading (c) colours behind the text (d) makes letters bigger
  13. 13.🎯 Which CSS selector matches this element?
    <li class="big" id="top">Hello</li>
    (a) .top (b) .big (c) #intro (d) .red
  14. 14.✍️ What is the selector in this CSS rule?
    h2 {
      text-align: center;
      font-style: italic;
      border: 2px solid;
    }
    (a) italic (b) h2 (c) text-align (d) h1
  15. 15.🔍 Which is the odd one out? (a) rounds box corners (b) shows a pop-up message (c) checks a quiz answer (d) counts down a timer
  16. 16.🖌️ What colour are the letters?
    h1 {
      font-size: 40px;
      text-align: center;
      color: white;
      background-color: purple;
    }
    (a) purple (b) blue (c) white
  17. 17.💪 Which justify-content value packs boxes at the start? (a) flex-start (b) flex-end (c) center (d) space-between
  18. 18.✍️ Which sign goes between a property and its value? (a) ; (b) = (c) : (d) -
  19. 19.🎯 Which CSS selector matches this element?
    <span class="red" id="hero">Hello</span>
    (a) .hero (b) p (c) .red (d) #red
  20. 20.⚖️ Which selector is the weakest? (a) an id selector (b) an element selector (c) a class selector
  21. 21.🧩 Which language adds space around boxes? (a) CSS (b) JavaScript (c) HTML
  22. 22.🖌️ What colour is behind the letters?
    h1 {
      text-align: center;
      color: black;
      font-size: 32px;
      background-color: green;
    }
    (a) green (b) purple (c) black
  23. 23.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 28px;
      }
    }
  24. 24.Which of these is padding? (a) a solid or dotted edge (b) the text or picture (c) space inside the border (d) space outside the border
  25. 25.⚖️ What colour is the text of this element?
    <h2 class="star" id="top">Hi</h2>
    CSS:
    #top { color: black; }
    h2 { color: red; }
    .star { color: green; }
    (a) orange (b) black (c) red (d) green
  26. 26.🌈 Which colour of light is strongest in rgb(32, 189, 129)? (a) green (b) red (c) blue
  27. 27.Which of these does HTML do? (a) adds space around boxes (b) makes a form box (c) counts down a timer (d) shows a pop-up message
  28. 28.📱 Which tag helps phones show a page at the right size? (a) the title tag (b) the viewport meta tag (c) the br tag (d) the hr tag
  29. 29.⚖️ Which selector is the strongest? (a) a class selector (b) an element selector (c) an id selector
  30. 30.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 22px;
      }
    }
  31. 31.🖌️ What colour are the letters?
    h2 {
      text-align: right;
      background-color: white;
      color: blue;
      font-size: 16px;
    }
    (a) blue (b) white (c) yellow
  32. 32.True or false: CSS makes a form box. (a) True (b) False
  33. 33.🧩 Which language reacts to a button click? (a) HTML (b) CSS (c) JavaScript
  34. 34.🎯 Which element does the selector .star style? (a) <span class="menu"> (b) <span class="star"> (c) <span id="star"> (d) <p class="note">
  35. 35.🌈 Which colour is #0000ff? (a) cyan (b) blue (c) yellow (d) red
  36. 36.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 10px;
      }
    }
  37. 37.🎨 Which tag holds CSS inside the head? (a) <style> (b) <script> (c) <css> (d) <body>
  38. 38.✍️ How many declarations (property: value pairs) are in this rule?
    body {
      font-weight: bold;
      text-align: center;
    }
  39. 39.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 14px;
      }
    }
  40. 40.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 180px;
      justify-content: flex-start;
    }
    Inside are 3 boxes, each 40px wide (no margins).

Answer key

  1. 1
  2. 80
  3. red
  4. center
  5. ;
  6. flex-direction
  7. #logo
  8. border
  9. 70
  10. orange
  11. padding
  12. centres a heading
  13. .big
  14. h2
  15. rounds box corners
  16. white
  17. flex-start
  18. :
  19. .red
  20. an element selector
  21. CSS
  22. green
  23. 24
  24. space inside the border
  25. black
  26. green
  27. makes a form box
  28. the viewport meta tag
  29. an id selector
  30. 22
  31. blue
  32. False
  33. JavaScript
  34. <span class="star">
  35. blue
  36. 16
  37. <style>
  38. 2
  39. 14
  40. 60

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