← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 499 · 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 wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 240px;
      justify-content: space-between;
    }
    Inside are 3 boxes, each 60px wide (no margins).
  2. 2.✍️ Which property is set to 8px in this rule?
    p {
      color: red;
      padding: 8px;
      margin: 10px;
      font-weight: bold;
    }
    (a) border (b) font-weight (c) padding (d) 8px
  3. 3.⚖️ What colour is the text of this element?
    <h2 class="big" id="end">Hi</h2>
    CSS:
    .big { color: white; }
    h2 { color: orange; }
    #end { color: blue; }
    (a) blue (b) red (c) white (d) orange
  4. 4.🖌️ Where does the text sit on its line?
    h2 {
      font-size: 16px;
      color: red;
      background-color: black;
      text-align: left;
    }
    (a) in the middle (b) on the right (c) on the left
  5. 5.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 260px;
      justify-content: center;
    }
    Inside are 3 boxes, each 40px wide (no margins).
  6. 6.✍️ How does a CSS comment start? (a) // (b) # (c) <!-- (d) /*
  7. 7.🎯 What kind of selector is body? (a) an id selector (b) a class selector (c) an element selector
  8. 8.🎯 Which CSS selector matches this element?
    <div class="star" id="hero">Hello</div>
    (a) div (b) .menu (c) #top (d) span
  9. 9.✍️ What value is given to color in this rule?
    h1 {
      font-weight: bold;
      margin: 10px;
      padding: 8px;
      color: red;
    }
    (a) color (b) center (c) 20px (d) red
  10. 10.🖌️ What colour are the letters?
    p {
      text-align: left;
      font-size: 36px;
      color: blue;
      background-color: green;
    }
    (a) green (b) blue (c) purple
  11. 11.Which of these does HTML do? (a) checks a quiz answer (b) sets colours and fonts (c) makes a form box (d) reacts to a button click
  12. 12.🔍 Which is the odd one out? (a) checks a quiz answer (b) adds space around boxes (c) rounds box corners (d) changes the text size
  13. 13.🎯 Which CSS selector matches this element?
    <span class="box" id="end">Hello</span>
    (a) #box (b) .end (c) .box (d) .star
  14. 14.💪 Which justify-content value equal gaps, none at ends? (a) center (b) flex-start (c) space-between (d) flex-end
  15. 15.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 30px;
      }
    }
  16. 16.Which of these does CSS do? (a) changes the page live (b) puts a picture on a page (c) rounds box corners (d) reacts to a button click
  17. 17.⚖️ Which selector is the strongest? (a) a class selector (b) an id selector (c) an element selector
  18. 18.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 50px;
      padding: 10px;
      border: 4px solid black;
      margin: 20px;
    }
  19. 19.📦 In the box model, which part is the line round the box? (a) margin (b) content (c) border (d) padding
  20. 20.🎯 Which CSS selector matches this element?
    <li class="menu" id="hero">Hello</li>
    (a) .hero (b) div (c) li (d) #top
  21. 21.🎯 Which sign starts a class selector? (a) . (b) @ (c) & (d) #
  22. 22.🧩 Which language checks a quiz answer? (a) JavaScript (b) HTML (c) CSS
  23. 23.🌈 Which colour is #ffffff? (a) yellow (b) red (c) white (d) black
  24. 24.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 210px;
      padding: 30px;
      border: 1px solid black;
      margin: 20px;
    }
  25. 25.✍️ In color: blue; which part is the property? (a) : (b) blue (c) color (d) ;
  26. 26.⚖️ What colour is the text of this element?
    <p class="note" id="main">Hi</p>
    CSS:
    p { color: blue; }
    p { color: yellow; }
    (a) blue (b) white (c) yellow (d) green
  27. 27.📱 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;
      }
    }
  28. 28.✍️ Which sign ends each CSS declaration? (a) : (b) ; (c) . (d) ,
  29. 29.🖌️ What colour is behind the letters?
    li {
      font-size: 40px;
      background-color: yellow;
      text-align: right;
      color: red;
    }
    (a) white (b) red (c) yellow
  30. 30.🎯 What kind of selector is li? (a) a class selector (b) an id selector (c) an element selector
  31. 31.📱 The screen is 700px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 14px;
      }
    }
    (a) Yes (b) No
  32. 32.✍️ What is the selector in this CSS rule?
    #top {
      font-weight: bold;
      color: red;
      background-color: yellow;
      font-size: 20px;
    }
    (a) red (b) li (c) font-weight (d) #top
  33. 33.True or false: .big is an element selector. (a) True (b) False
  34. 34.✍️ Which property is set to 8px in this rule?
    p {
      text-align: center;
      padding: 8px;
    }
    (a) font-weight (b) 8px (c) border (d) padding
  35. 35.🌈 Which colour of light is strongest in rgb(155, 4, 64)? (a) red (b) blue (c) green
  36. 36.🧩 Which language makes a link? (a) JavaScript (b) CSS (c) HTML
  37. 37.True or false: HTML shows a pop-up message. (a) True (b) False
  38. 38.⚖️ What colour is the text of this element?
    <h2 class="big" id="top">Hi</h2>
    CSS:
    h2 { color: green; }
    h2 { color: yellow; }
    (a) green (b) black (c) yellow (d) white
  39. 39.🎨 Which tag holds CSS inside the head? (a) <body> (b) <script> (c) <css> (d) <style>
  40. 40.🎯 How many elements on a page should have the same id? (a) 2 (b) any number (c) 1 (d) 5

Answer key

  1. 30
  2. padding
  3. blue
  4. on the left
  5. 70
  6. /*
  7. an element selector
  8. div
  9. red
  10. blue
  11. makes a form box
  12. checks a quiz answer
  13. .box
  14. space-between
  15. 24
  16. rounds box corners
  17. an id selector
  18. 78
  19. border
  20. li
  21. .
  22. JavaScript
  23. white
  24. 312
  25. color
  26. yellow
  27. 14
  28. ;
  29. yellow
  30. an element selector
  31. No
  32. #top
  33. False
  34. padding
  35. red
  36. HTML
  37. False
  38. yellow
  39. <style>
  40. 1

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