← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 857 · 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 justify-content value equal gaps, none at ends? (a) space-between (b) flex-end (c) flex-start (d) center
  2. 2.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 190px;
      padding: 5px;
      border: 2px solid black;
      margin: 15px;
    }
  3. 3.✍️ How many declarations (property: value pairs) are in this rule?
    p {
      text-align: center;
      background-color: yellow;
      font-weight: bold;
      font-size: 20px;
    }
  4. 4.📱 min-width: 800px applies when the screen is ___. (a) exactly 100px (b) turned off (c) 800px or wider (d) 800px or narrower
  5. 5.💪 Which justify-content value puts boxes in the middle? (a) flex-start (b) flex-end (c) center (d) space-between
  6. 6.⚖️ What colour is the text of this element?
    <p class="box" id="logo">Hi</p>
    CSS:
    p { color: orange; }
    p { color: green; }
    (a) orange (b) yellow (c) green (d) blue
  7. 7.🎯 Which CSS selector matches this element?
    <span class="star" id="logo">Hello</span>
    (a) p (b) .menu (c) #end (d) #logo
  8. 8.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 180px;
      justify-content: space-between;
    }
    Inside are 2 boxes, each 80px wide (no margins).
  9. 9.📦 In the box model, which part is space outside the border? (a) content (b) margin (c) border (d) padding
  10. 10.🎯 Which sign starts an id selector? (a) . (b) & (c) # (d) @
  11. 11.🌈 Which colour is #00ffff? (a) blue (b) magenta (c) bright green (d) cyan
  12. 12.⚖️ What colour is the text of this element?
    <h1 class="box" id="logo">Hi</h1>
    CSS:
    h1 { color: orange; }
    h1 { color: red; }
    (a) green (b) orange (c) red (d) white
  13. 13.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 22px;
      }
    }
  14. 14.📱 The screen is 1366px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 22px;
      }
    }
    (a) No (b) Yes
  15. 15.🎯 What kind of selector is .card? (a) an element selector (b) a class selector (c) an id selector
  16. 16.✍️ In color: blue; which part is the value? (a) color (b) : (c) ; (d) blue
  17. 17.True or false: JavaScript checks a quiz answer. (a) True (b) False
  18. 18.🎯 Which sign starts a class selector? (a) . (b) # (c) & (d) @
  19. 19.True or false: margin is space outside the border. (a) True (b) False
  20. 20.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 12px;
      }
    }
  21. 21.What does justify-content: space-between do? (a) equal gaps, none at ends (b) packs boxes at the end (c) puts boxes in the middle (d) packs boxes at the start
  22. 22.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 160px;
      padding: 25px;
      border: 2px solid black;
      margin: 10px;
    }
  23. 23.True or false: CSS rounds box corners. (a) True (b) False
  24. 24.True or false: padding is the gap round content. (a) False (b) True
  25. 25.📦 In the box model, which part is the gap round content? (a) content (b) border (c) padding (d) margin
  26. 26.⚖️ Two rules with the same selector set a colour. Which one wins? (a) neither (b) the first one (c) the shorter one (d) the later one
  27. 27.✍️ What is the selector in this CSS rule?
    li {
      margin: 10px;
      background-color: yellow;
    }
    (a) body (b) yellow (c) li (d) margin
  28. 28.⚖️ What colour is the text of this element?
    <p class="box" id="hero">Hi</p>
    CSS:
    .box { color: white; }
    #hero { color: red; }
    p { color: yellow; }
    (a) white (b) blue (c) yellow (d) red
  29. 29.⚖️ What colour is the text of this element?
    <h1 class="big" id="main">Hi</h1>
    CSS:
    .big { color: red; }
    .big { color: purple; }
    (a) purple (b) green (c) red (d) black
  30. 30.Which of these does HTML do? (a) makes a form box (b) shows a pop-up message (c) adds space around boxes (d) rounds box corners
  31. 31.🖌️ What colour is behind the letters?
    li {
      color: white;
      text-align: left;
      background-color: black;
      font-size: 36px;
    }
    (a) blue (b) black (c) white
  32. 32.📱 The screen is 1100px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 18px;
      }
    }
    (a) No (b) Yes
  33. 33.⚖️ What colour is the text of this element?
    <p class="note" id="logo">Hi</p>
    CSS:
    p { color: yellow; }
    #logo { color: purple; }
    .note { color: blue; }
    (a) black (b) blue (c) purple (d) yellow
  34. 34.⚖️ What colour is the text of this element?
    <h2 class="star" id="main">Hi</h2>
    CSS:
    h2 { color: yellow; }
    h2 { color: purple; }
    (a) orange (b) purple (c) yellow (d) white
  35. 35.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 170px;
      padding: 25px;
      border: 2px solid black;
      margin: 10px;
    }
  36. 36.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 60px;
      padding: 5px;
      border: 2px solid black;
      margin: 20px;
    }
  37. 37.🌈 In #890000 the red part is the hex number 89. What is it as a normal number?
  38. 38.What does font-weight do? (a) picks the font style (b) makes the text bold (c) centres a heading (d) sets the letter colour
  39. 39.✍️ What value is given to font-style in this rule?
    body {
      font-style: italic;
      border: 2px solid;
      width: 300px;
    }
    (a) 20px (b) italic (c) font-style (d) red
  40. 40.✍️ How many declarations (property: value pairs) are in this rule?
    h2 {
      text-align: center;
    }

Answer key

  1. space-between
  2. 234
  3. 4
  4. 800px or wider
  5. center
  6. green
  7. #logo
  8. 20
  9. margin
  10. #
  11. cyan
  12. red
  13. 22
  14. Yes
  15. a class selector
  16. blue
  17. True
  18. .
  19. True
  20. 12
  21. equal gaps, none at ends
  22. 234
  23. True
  24. True
  25. padding
  26. the later one
  27. li
  28. red
  29. purple
  30. makes a form box
  31. black
  32. Yes
  33. purple
  34. purple
  35. 244
  36. 114
  37. 137
  38. makes the text bold
  39. italic
  40. 1

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