← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 752 · 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.📱 max-width: 600px applies when the screen is ___. (a) 600px or wider (b) exactly 1000px (c) 600px or narrower (d) turned off
  2. 2.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 130px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 40px wide (no margins).
  3. 3.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the first one (b) neither (c) the shorter one (d) the later one
  4. 4.⚖️ What colour is the text of this element?
    <h1 class="star" id="intro">Hi</h1>
    CSS:
    h1 { color: black; }
    h1 { color: red; }
    (a) red (b) purple (c) black (d) orange
  5. 5.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 230px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 80px wide (no margins).
  6. 6.📱 The screen is 1366px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 18px;
      }
    }
    (a) Yes (b) No
  7. 7.🖌️ Which CSS property makes the text bold? (a) text-align (b) font-size (c) font-weight (d) font-family
  8. 8.🖌️ What colour is behind the letters?
    h2 {
      color: green;
      font-size: 28px;
      text-align: right;
      background-color: purple;
    }
    (a) blue (b) purple (c) green
  9. 9.✍️ CSS declarations go inside which brackets? (a) < > (b) ( ) (c) [ ] (d) { }
  10. 10.💪 Which flexbox property turns on flexbox? (a) display: flex (b) justify-content (c) flex-direction (d) gap
  11. 11.True or false: padding is a solid or dotted edge. (a) True (b) False
  12. 12.🔍 Which is the odd one out? (a) changes the text size (b) rounds box corners (c) adds space around boxes (d) counts down a timer
  13. 13.True or false: CSS lays out the page. (a) True (b) False
  14. 14.What does font-family do? (a) picks the font style (b) colours behind the text (c) centres a heading (d) makes the text bold
  15. 15.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 70px;
      padding: 10px;
      border: 1px solid black;
      margin: 15px;
    }
  16. 16.🎨 Which attribute adds CSS inside one tag? (a) src (b) alt (c) style (d) href
  17. 17.⚖️ What colour is the text of this element?
    <h1 class="note" id="main">Hi</h1>
    CSS:
    .note { color: white; }
    #main { color: orange; }
    h1 { color: purple; }
    (a) green (b) white (c) purple (d) orange
  18. 18.✍️ In color: blue; which part is the property? (a) blue (b) color (c) ; (d) :
  19. 19.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 16px;
      }
    }
  20. 20.⚖️ What colour is the text of this element?
    <h1 class="star" id="logo">Hi</h1>
    CSS:
    .star { color: blue; }
    #logo { color: red; }
    (a) purple (b) red (c) green (d) blue
  21. 21.⚖️ Which selector is the strongest? (a) a class selector (b) an element selector (c) an id selector
  22. 22.✍️ What is the selector in this CSS rule?
    .box {
      font-size: 20px;
      padding: 8px;
      margin: 10px;
      color: red;
    }
    (a) font-size (b) 8px (c) h2 (d) .box
  23. 23.🌈 Which hex code is blue? (a) #000000 (b) #00ff00 (c) #0000ff (d) #ffffff
  24. 24.✍️ How many declarations (property: value pairs) are in this rule?
    .box {
      border: 2px solid;
      font-weight: bold;
      text-align: center;
    }
  25. 25.⚖️ What colour is the text of this element?
    <p class="star" id="intro">Hi</p>
    CSS:
    .star { color: white; }
    #intro { color: yellow; }
    (a) yellow (b) white (c) blue (d) green
  26. 26.⚖️ What colour is the text of this element?
    <h2 class="big" id="end">Hi</h2>
    CSS:
    h2 { color: green; }
    h2 { color: white; }
    (a) green (b) purple (c) yellow (d) white
  27. 27.True or false: padding is the gap to other boxes. (a) False (b) True
  28. 28.🎯 Which CSS selector matches this element?
    <p class="big" id="hero">Hello</p>
    (a) .hero (b) h1 (c) #big (d) .big
  29. 29.🖌️ Which CSS property makes letters bigger? (a) text-align (b) font-weight (c) color (d) font-size
  30. 30.⚖️ What colour is the text of this element?
    <h1 class="star" id="logo">Hi</h1>
    CSS:
    .star { color: purple; }
    h1 { color: orange; }
    (a) blue (b) yellow (c) purple (d) orange
  31. 31.🎯 What kind of selector is .star? (a) an element selector (b) an id selector (c) a class selector
  32. 32.⚖️ What colour is the text of this element?
    <p class="star" id="main">Hi</p>
    CSS:
    .star { color: yellow; }
    .star { color: black; }
    (a) green (b) yellow (c) red (d) black
  33. 33.🎯 Which element does the selector .note style? (a) <h1 class="big"> (b) <h2 class="red"> (c) <h1 id="note"> (d) <h1 class="note">
  34. 34.✍️ What value is given to margin in this rule?
    p {
      background-color: yellow;
      margin: 10px;
    }
    (a) bold (b) 8px (c) margin (d) 10px
  35. 35.🌈 Which hex code is magenta? (a) #000000 (b) #ff00ff (c) #00ffff (d) #ff0000
  36. 36.✍️ How many declarations (property: value pairs) are in this rule?
    h2 {
      width: 300px;
      color: red;
      font-weight: bold;
    }
  37. 37.🖌️ Which CSS property picks the font style? (a) font-family (b) text-align (c) background-color (d) font-weight
  38. 38.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 180px;
      padding: 20px;
      border: 1px solid black;
      margin: 5px;
    }
  39. 39.🌈 In #0000a3 the blue part is the hex number a3. What is it as a normal number?
  40. 40.🌈 Which colour is #ff0000? (a) magenta (b) blue (c) red (d) cyan

Answer key

  1. 600px or narrower
  2. 50
  3. the later one
  4. red
  5. 70
  6. Yes
  7. font-weight
  8. purple
  9. { }
  10. display: flex
  11. False
  12. counts down a timer
  13. True
  14. picks the font style
  15. 122
  16. style
  17. orange
  18. color
  19. 16
  20. red
  21. an id selector
  22. .box
  23. #0000ff
  24. 3
  25. yellow
  26. white
  27. False
  28. .big
  29. font-size
  30. purple
  31. a class selector
  32. black
  33. <h1 class="note">
  34. 10px
  35. #ff00ff
  36. 3
  37. font-family
  38. 232
  39. 163
  40. red

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