← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 598 · 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.🌈 In #rrggbb, which colour do the first two digits give? (a) blue (b) green (c) red (d) black
  2. 2.📦 In the box model, which part is the line round the box? (a) padding (b) border (c) margin (d) content
  3. 3.📦 In the box model, which part is the gap round content? (a) border (b) content (c) padding (d) margin
  4. 4.⚖️ What colour is the text of this element?
    <h2 class="star" id="hero">Hi</h2>
    CSS:
    #hero { color: red; }
    h2 { color: black; }
    (a) black (b) red (c) orange (d) yellow
  5. 5.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 280px;
      justify-content: center;
    }
    Inside are 3 boxes, each 40px wide (no margins).
  6. 6.🎯 Can many elements share the same class? (a) Yes (b) No
  7. 7.🔍 Which is the odd one out? (a) changes the page live (b) checks a quiz answer (c) reacts to a button click (d) puts a picture on a page
  8. 8.🌈 Hex digits go 0 to 9, then A to which letter? (a) F (b) Z (c) J (d) G
  9. 9.💪 Which flexbox property spaces boxes along a row? (a) gap (b) justify-content (c) display: flex (d) flex-direction
  10. 10.🎯 What kind of selector is .card? (a) an element selector (b) an id selector (c) a class selector
  11. 11.🎯 What kind of selector is .menu? (a) an id selector (b) an element selector (c) a class selector
  12. 12.✍️ In color: blue; which part is the property? (a) color (b) blue (c) : (d) ;
  13. 13.Which of these is padding? (a) space outside the border (b) a solid or dotted edge (c) the gap to other boxes (d) space inside the border
  14. 14.💪 Which justify-content value puts boxes in the middle? (a) space-between (b) flex-start (c) flex-end (d) center
  15. 15.Which of these is the content? (a) the text or picture (b) the gap to other boxes (c) a solid or dotted edge (d) the gap round content
  16. 16.✍️ How many declarations (property: value pairs) are in this rule?
    li {
      font-weight: bold;
      margin: 10px;
      width: 300px;
      font-style: italic;
    }
  17. 17.📱 max-width: 600px applies when the screen is ___. (a) 600px or wider (b) turned off (c) exactly 1000px (d) 600px or narrower
  18. 18.True or false: CSS gives the page structure. (a) True (b) False
  19. 19.🌈 Which colour is #ffff00? (a) black (b) bright green (c) yellow (d) cyan
  20. 20.⚖️ Two rules with the same selector set a colour. Which one wins? (a) neither (b) the first one (c) the later one (d) the shorter one
  21. 21.⚖️ What colour is the text of this element?
    <p class="note" id="intro">Hi</p>
    CSS:
    .note { color: purple; }
    .note { color: blue; }
    (a) purple (b) blue (c) green (d) white
  22. 22.🖌️ Which CSS property makes letters bigger? (a) text-align (b) font-weight (c) color (d) font-size
  23. 23.✍️ How many declarations (property: value pairs) are in this rule?
    h1 {
      text-align: center;
      color: red;
      font-size: 20px;
      background-color: yellow;
    }
  24. 24.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 22px;
      }
    }
  25. 25.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 6px;
      }
    }
    (a) No (b) Yes
  26. 26.🖌️ Which CSS property colours behind the text? (a) text-align (b) font-size (c) background-color (d) color
  27. 27.💪 Which flexbox property sets space between boxes? (a) justify-content (b) display: flex (c) gap (d) flex-direction
  28. 28.⚖️ What colour is the text of this element?
    <p class="note" id="top">Hi</p>
    CSS:
    #top { color: orange; }
    .note { color: blue; }
    p { color: green; }
    (a) blue (b) white (c) orange (d) green
  29. 29.🎯 Which element does the selector .red style? (a) <p class="red"> (b) <h1 class="star"> (c) <p class="box"> (d) <p id="red">
  30. 30.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 430px;
      justify-content: flex-end;
    }
    Inside are 4 boxes, each 100px wide (no margins).
  31. 31.🧩 Which language counts down a timer? (a) HTML (b) JavaScript (c) CSS
  32. 32.🔍 Which is the odd one out? (a) makes a form box (b) changes the text size (c) lays out the page (d) adds space around boxes
  33. 33.⚖️ Which selector is the weakest? (a) an element selector (b) an id selector (c) a class selector
  34. 34.Which of these is margin? (a) space inside the border (b) the gap to other boxes (c) a solid or dotted edge (d) the line round the box
  35. 35.📱 The screen is 540px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 20px;
      }
    }
    (a) No (b) Yes
  36. 36.🌈 Which hex code is black? (a) #ff0000 (b) #000000 (c) #ffff00 (d) #ffffff
  37. 37.⚖️ What colour is the text of this element?
    <h1 class="red" id="intro">Hi</h1>
    CSS:
    .red { color: yellow; }
    #intro { color: red; }
    (a) green (b) yellow (c) red (d) blue
  38. 38.✍️ What value is given to padding in this rule?
    body {
      padding: 8px;
      text-align: center;
    }
    (a) padding (b) bold (c) 2px solid (d) 8px
  39. 39.🌈 Which colour is #00ffff? (a) white (b) yellow (c) cyan (d) red
  40. 40.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 50px;
      padding: 25px;
      border: 3px solid black;
      margin: 0px;
    }

Answer key

  1. red
  2. border
  3. padding
  4. red
  5. 80
  6. Yes
  7. puts a picture on a page
  8. F
  9. justify-content
  10. a class selector
  11. a class selector
  12. color
  13. space inside the border
  14. center
  15. the text or picture
  16. 4
  17. 600px or narrower
  18. False
  19. yellow
  20. the later one
  21. blue
  22. font-size
  23. 4
  24. 22
  25. Yes
  26. background-color
  27. gap
  28. orange
  29. <p class="red">
  30. 30
  31. JavaScript
  32. makes a form box
  33. an element selector
  34. the gap to other boxes
  35. Yes
  36. #000000
  37. red
  38. 8px
  39. cyan
  40. 106

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