← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 694 · 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 is the odd one out? (a) reacts to a button click (b) sets colours and fonts (c) changes the text size (d) adds space around boxes
  2. 2.📱 The screen is 820px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 22px;
      }
    }
    (a) No (b) Yes
  3. 3.⚖️ What colour is the text of this element?
    <p class="note" id="hero">Hi</p>
    CSS:
    #hero { color: yellow; }
    .note { color: orange; }
    p { color: green; }
    (a) black (b) green (c) orange (d) yellow
  4. 4.🌈 Which colour is #ff0000? (a) white (b) red (c) cyan (d) blue
  5. 5.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 10px;
      }
    }
  6. 6.True or false: JavaScript puts a picture on a page. (a) False (b) True
  7. 7.🔍 Which is the odd one out? (a) rounds box corners (b) shows a pop-up message (c) reacts to a button click (d) counts down a timer
  8. 8.What does justify-content: center do? (a) packs boxes at the start (b) puts boxes in the middle (c) equal gaps, none at ends (d) packs boxes at the end
  9. 9.🖌️ What colour is behind the letters?
    h1 {
      font-size: 12px;
      background-color: white;
      text-align: right;
      color: black;
    }
    (a) blue (b) black (c) white
  10. 10.True or false: JavaScript changes the text size. (a) False (b) True
  11. 11.✍️ How does a CSS comment start? (a) # (b) // (c) <!-- (d) /*
  12. 12.Which of these does JavaScript do? (a) checks a quiz answer (b) gives the page structure (c) puts a picture on a page (d) makes a link
  13. 13.🖌️ Which CSS property picks the font style? (a) font-size (b) font-family (c) background-color (d) text-align
  14. 14.⚖️ What colour is the text of this element?
    <p class="note" id="main">Hi</p>
    CSS:
    .note { color: purple; }
    .note { color: black; }
    (a) black (b) green (c) white (d) purple
  15. 15.📱 Responsive design means a page ___. (a) is only for laptops (b) never changes (c) fits every screen (d) has no pictures
  16. 16.🎯 Which sign starts an id selector? (a) @ (b) . (c) & (d) #
  17. 17.💪 Which flexbox property turns on flexbox? (a) display: flex (b) align-items (c) gap (d) justify-content
  18. 18.🎯 Which element does the selector h2 style? (a) <li> (b) <div class="box"> (c) <h2 class="box"> (d) <span id="end">
  19. 19.✍️ What value is given to font-style in this rule?
    p {
      color: red;
      width: 300px;
      border: 2px solid;
      font-style: italic;
    }
    (a) font-style (b) red (c) 20px (d) italic
  20. 20.⚖️ What colour is the text of this element?
    <p class="big" id="top">Hi</p>
    CSS:
    #top { color: black; }
    #top { color: white; }
    (a) orange (b) white (c) black (d) red
  21. 21.Which of these is padding? (a) a solid or dotted edge (b) the line round the box (c) the text or picture (d) space inside the border
  22. 22.True or false: padding is the text or picture. (a) False (b) True
  23. 23.🌈 In #rrggbb, which colour do the first two digits give? (a) blue (b) green (c) black (d) red
  24. 24.✍️ What value is given to padding in this rule?
    #top {
      text-align: center;
      padding: 8px;
      width: 300px;
      font-style: italic;
    }
    (a) bold (b) 8px (c) 2px solid (d) padding
  25. 25.True or false: JavaScript checks a quiz answer. (a) False (b) True
  26. 26.🖌️ Which CSS property makes letters bigger? (a) background-color (b) font-size (c) font-family (d) color
  27. 27.🌈 Which colour is #000000? (a) red (b) bright green (c) black (d) cyan
  28. 28.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 350px;
      justify-content: space-between;
    }
    Inside are 4 boxes, each 50px wide (no margins).
  29. 29.✍️ What is the selector in this CSS rule?
    body {
      text-align: center;
      font-size: 20px;
    }
    (a) text-align (b) .box (c) body (d) 20px
  30. 30.🌈 Which colour of light is strongest in rgb(29, 89, 163)? (a) red (b) green (c) blue
  31. 31.🧩 Which language makes headings and lists? (a) HTML (b) CSS (c) JavaScript
  32. 32.✍️ How many declarations (property: value pairs) are in this rule?
    li {
      background-color: yellow;
    }
  33. 33.🌈 Which colour is #ff00ff? (a) blue (b) magenta (c) bright green (d) red
  34. 34.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 260px;
      justify-content: center;
    }
    Inside are 2 boxes, each 50px wide (no margins).
  35. 35.🧩 Which language makes a form box? (a) CSS (b) JavaScript (c) HTML
  36. 36.True or false: CSS checks a quiz answer. (a) False (b) True
  37. 37.⚖️ What colour is the text of this element?
    <h2 class="star" id="main">Hi</h2>
    CSS:
    h2 { color: white; }
    h2 { color: orange; }
    (a) orange (b) green (c) white (d) blue
  38. 38.✍️ What is the selector in this CSS rule?
    h2 {
      margin: 10px;
      font-size: 20px;
      border: 2px solid;
    }
    (a) h2 (b) h1 (c) margin (d) 20px
  39. 39.Which of these does CSS do? (a) makes headings and lists (b) sets colours and fonts (c) changes the page live (d) makes a link
  40. 40.✍️ How many declarations (property: value pairs) are in this rule?
    h1 {
      border: 2px solid;
      color: red;
      font-weight: bold;
    }

Answer key

  1. reacts to a button click
  2. No
  3. yellow
  4. red
  5. 10
  6. False
  7. rounds box corners
  8. puts boxes in the middle
  9. white
  10. False
  11. /*
  12. checks a quiz answer
  13. font-family
  14. black
  15. fits every screen
  16. #
  17. display: flex
  18. <h2 class="box">
  19. italic
  20. white
  21. space inside the border
  22. False
  23. red
  24. 8px
  25. True
  26. font-size
  27. black
  28. 50
  29. body
  30. blue
  31. HTML
  32. 1
  33. magenta
  34. 80
  35. HTML
  36. False
  37. orange
  38. h2
  39. sets colours and fonts
  40. 3

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