← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 208 · 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 gives the page structure? (a) JavaScript (b) CSS (c) HTML
  2. 2.🧩 Which language makes headings and lists? (a) HTML (b) CSS (c) JavaScript
  3. 3.🎨 What does CSS stand for? (a) Colourful Site Styles (b) Cascading Style Sheets (c) Creative Sheet System (d) Computer Style Sheets
  4. 4.🌈 In #009900 the green part is the hex number 99. What is it as a normal number?
  5. 5.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 60px;
      padding: 30px;
      border: 5px solid black;
      margin: 10px;
    }
  6. 6.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 32px;
      }
    }
  7. 7.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 16px;
      }
    }
    (a) Yes (b) No
  8. 8.✍️ What is the selector in this CSS rule?
    li {
      background-color: yellow;
      border: 2px solid;
    }
    (a) background-color (b) 2px solid (c) body (d) li
  9. 9.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 140px;
      justify-content: flex-end;
    }
    Inside are 2 boxes, each 50px wide (no margins).
  10. 10.📱 The screen is 540px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 10px;
      }
    }
    (a) Yes (b) No
  11. 11.🖌️ How big is the text, in px?
    li {
      color: white;
      font-size: 32px;
      text-align: center;
      background-color: blue;
    }
  12. 12.🔍 Which is the odd one out? (a) rounds box corners (b) shows a pop-up message (c) changes the page live (d) checks a quiz answer
  13. 13.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 120px;
      padding: 15px;
      border: 1px solid black;
      margin: 5px;
    }
  14. 14.What does justify-content: flex-end do? (a) equal gaps, none at ends (b) packs boxes at the end (c) packs boxes at the start (d) puts boxes in the middle
  15. 15.🎨 Which tag holds CSS inside the head? (a) <body> (b) <style> (c) <css> (d) <script>
  16. 16.📱 The screen is 820px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 18px;
      }
    }
    (a) Yes (b) No
  17. 17.⚖️ Which selector is the strongest? (a) a class selector (b) an element selector (c) an id selector
  18. 18.⚖️ What colour is the text of this element?
    <h2 class="star" id="end">Hi</h2>
    CSS:
    .star { color: black; }
    .star { color: blue; }
    (a) blue (b) white (c) orange (d) black
  19. 19.💪 Which flexbox property sets space between boxes? (a) align-items (b) flex-direction (c) display: flex (d) gap
  20. 20.🔍 Which is the odd one out? (a) changes the page live (b) makes headings and lists (c) counts down a timer (d) checks a quiz answer
  21. 21.✍️ Which property is set to 2px solid in this rule?
    body {
      text-align: center;
      margin: 10px;
      padding: 8px;
      border: 2px solid;
    }
    (a) 2px solid (b) width (c) border (d) font-style
  22. 22.What does font-size do? (a) makes the text bold (b) centres a heading (c) makes letters bigger (d) sets the letter colour
  23. 23.🖌️ What colour are the letters?
    h1 {
      font-size: 16px;
      color: white;
      background-color: black;
      text-align: right;
    }
    (a) black (b) yellow (c) white
  24. 24.🌈 Which colour of light is strongest in rgb(129, 7, 150)? (a) green (b) blue (c) red
  25. 25.⚖️ What colour is the text of this element?
    <p class="big" id="intro">Hi</p>
    CSS:
    .big { color: blue; }
    .big { color: purple; }
    (a) black (b) purple (c) blue (d) red
  26. 26.🖌️ Which CSS property makes the text bold? (a) font-weight (b) font-family (c) text-align (d) color
  27. 27.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 10px;
      }
    }
  28. 28.Which of these does JavaScript do? (a) lays out the page (b) rounds box corners (c) reacts to a button click (d) makes a form box
  29. 29.True or false: the border is the text or picture. (a) False (b) True
  30. 30.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 60px;
      padding: 20px;
      border: 5px solid black;
      margin: 15px;
    }
  31. 31.🧩 Which language puts a picture on a page? (a) JavaScript (b) CSS (c) HTML
  32. 32.🎯 Which sign starts an id selector? (a) & (b) . (c) # (d) @
  33. 33.What does font-weight do? (a) makes the text bold (b) makes letters bigger (c) colours behind the text (d) sets the letter colour
  34. 34.True or false: padding is the line round the box. (a) False (b) True
  35. 35.✍️ What is the selector in this CSS rule?
    .box {
      padding: 8px;
      margin: 10px;
    }
    (a) .box (b) 10px (c) h2 (d) padding
  36. 36.🎯 What kind of selector is p? (a) an id selector (b) an element selector (c) a class selector
  37. 37.🎯 Which CSS selector matches this element?
    <li class="big" id="top">Hello</li>
    (a) div (b) .red (c) .big (d) .top
  38. 38.True or false: CSS adds space around boxes. (a) False (b) True
  39. 39.⚖️ What colour is the text of this element?
    <h2 class="star" id="hero">Hi</h2>
    CSS:
    h2 { color: black; }
    h2 { color: orange; }
    (a) black (b) white (c) orange (d) yellow
  40. 40.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 250px;
      justify-content: flex-end;
    }
    Inside are 4 boxes, each 50px wide (no margins).

Answer key

  1. HTML
  2. HTML
  3. Cascading Style Sheets
  4. 153
  5. 150
  6. 24
  7. No
  8. li
  9. 40
  10. No
  11. 32
  12. rounds box corners
  13. 152
  14. packs boxes at the end
  15. <style>
  16. No
  17. an id selector
  18. blue
  19. gap
  20. makes headings and lists
  21. border
  22. makes letters bigger
  23. white
  24. blue
  25. purple
  26. font-weight
  27. 10
  28. reacts to a button click
  29. False
  30. 140
  31. HTML
  32. #
  33. makes the text bold
  34. False
  35. .box
  36. an element selector
  37. .big
  38. True
  39. orange
  40. 50

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