← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 189 · 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 property is set to bold in this rule?
    .box {
      font-weight: bold;
      font-style: italic;
    }
    (a) border (b) bold (c) width (d) font-weight
  2. 2.🎯 Which CSS selector matches this element?
    <h2 class="note" id="top">Hello</h2>
    (a) h2 (b) #intro (c) .top (d) .big
  3. 3.🔍 Which is the odd one out? (a) gives the page structure (b) makes headings and lists (c) checks a quiz answer (d) puts a picture on a page
  4. 4.True or false: .star is a class selector. (a) False (b) True
  5. 5.💪 Which justify-content value packs boxes at the start? (a) flex-end (b) flex-start (c) space-between (d) center
  6. 6.🧩 Which language reacts to a button click? (a) CSS (b) JavaScript (c) HTML
  7. 7.⚖️ What colour is the text of this element?
    <h1 class="box" id="hero">Hi</h1>
    CSS:
    #hero { color: black; }
    .box { color: purple; }
    (a) orange (b) black (c) purple (d) yellow
  8. 8.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 16px;
      }
    }
  9. 9.🌈 Which colour of light is strongest in rgb(185, 33, 117)? (a) red (b) green (c) blue
  10. 10.🎨 Which tag holds CSS inside the head? (a) <css> (b) <script> (c) <body> (d) <style>
  11. 11.✍️ How many declarations (property: value pairs) are in this rule?
    h2 {
      padding: 8px;
    }
  12. 12.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 200px;
      padding: 25px;
      border: 3px solid black;
      margin: 15px;
    }
  13. 13.🖌️ Which CSS property makes letters bigger? (a) font-weight (b) font-size (c) color (d) font-family
  14. 14.True or false: the border is a solid or dotted edge. (a) False (b) True
  15. 15.⚖️ Which selector is the weakest? (a) a class selector (b) an element selector (c) an id selector
  16. 16.🧩 Which language changes the text size? (a) HTML (b) JavaScript (c) CSS
  17. 17.⚖️ What colour is the text of this element?
    <p class="star" id="hero">Hi</p>
    CSS:
    #hero { color: orange; }
    #hero { color: yellow; }
    (a) orange (b) blue (c) black (d) yellow
  18. 18.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 180px;
      padding: 25px;
      border: 4px solid black;
      margin: 10px;
    }
  19. 19.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 260px;
      padding: 5px;
      border: 1px solid black;
      margin: 20px;
    }
  20. 20.⚖️ What colour is the text of this element?
    <h2 class="red" id="top">Hi</h2>
    CSS:
    .red { color: black; }
    h2 { color: red; }
    (a) green (b) black (c) white (d) red
  21. 21.🖌️ What colour are the letters?
    p {
      font-size: 12px;
      text-align: right;
      color: yellow;
      background-color: orange;
    }
    (a) orange (b) yellow (c) blue
  22. 22.True or false: body is a class selector. (a) True (b) False
  23. 23.🌈 Which colour is rgb(255, 0, 0)? (a) blue (b) white (c) red (d) black
  24. 24.True or false: #end is a class selector. (a) False (b) True
  25. 25.✍️ How does a CSS comment start? (a) # (b) // (c) /* (d) <!--
  26. 26.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 150px;
      justify-content: space-between;
    }
    Inside are 2 boxes, each 40px wide (no margins).
  27. 27.True or false: img is an element selector. (a) False (b) True
  28. 28.📦 In the box model, which part is a solid or dotted edge? (a) content (b) margin (c) border (d) padding
  29. 29.🎯 Which CSS selector matches this element?
    <p class="menu" id="end">Hello</p>
    (a) .menu (b) .end (c) #menu (d) h1
  30. 30.🌈 In #0d0000 the red part is the hex number 0d. What is it as a normal number?
  31. 31.🔍 Which is the odd one out? (a) lays out the page (b) rounds box corners (c) puts a picture on a page (d) changes the text size
  32. 32.🖌️ What colour is behind the letters?
    p {
      text-align: left;
      color: purple;
      font-size: 24px;
      background-color: blue;
    }
    (a) purple (b) yellow (c) blue
  33. 33.🎯 What kind of selector is #main? (a) a class selector (b) an element selector (c) an id selector
  34. 34.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 140px;
      justify-content: space-between;
    }
    Inside are 2 boxes, each 50px wide (no margins).
  35. 35.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 290px;
      padding: 5px;
      border: 2px solid black;
      margin: 10px;
    }
  36. 36.🌈 Which colour is rgb(255, 0, 255)? (a) magenta (b) yellow (c) red (d) bright green
  37. 37.🔍 Which is the odd one out? (a) makes a form box (b) changes the text size (c) puts a picture on a page (d) makes a link
  38. 38.✍️ Which property is set to 2px solid in this rule?
    h1 {
      font-weight: bold;
      border: 2px solid;
      font-size: 20px;
    }
    (a) font-style (b) width (c) border (d) 2px solid
  39. 39.📱 Which tag helps phones show a page at the right size? (a) the title tag (b) the viewport meta tag (c) the br tag (d) the hr tag
  40. 40.⚖️ What colour is the text of this element?
    <h2 class="menu" id="logo">Hi</h2>
    CSS:
    #logo { color: black; }
    #logo { color: purple; }
    (a) yellow (b) white (c) black (d) purple

Answer key

  1. font-weight
  2. h2
  3. checks a quiz answer
  4. True
  5. flex-start
  6. JavaScript
  7. black
  8. 16
  9. red
  10. <style>
  11. 1
  12. 286
  13. font-size
  14. True
  15. an element selector
  16. CSS
  17. yellow
  18. 258
  19. 312
  20. black
  21. yellow
  22. False
  23. red
  24. False
  25. /*
  26. 70
  27. True
  28. border
  29. .menu
  30. 13
  31. puts a picture on a page
  32. blue
  33. an id selector
  34. 40
  35. 304
  36. magenta
  37. changes the text size
  38. border
  39. the viewport meta tag
  40. purple

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