← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 618 · 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.True or false: padding is the line round the box. (a) True (b) False
  2. 2.🎯 Which CSS selector matches this element?
    <h1 class="box" id="intro">Hello</h1>
    (a) .intro (b) h2 (c) .star (d) h1
  3. 3.⚖️ Which selector is the strongest? (a) an id selector (b) a class selector (c) an element selector
  4. 4.🎨 Which tag holds CSS inside the head? (a) <css> (b) <style> (c) <script> (d) <body>
  5. 5.🌈 Which hex code is yellow? (a) #ffff00 (b) #ff0000 (c) #00ff00 (d) #000000
  6. 6.📱 The screen is 700px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 20px;
      }
    }
    (a) Yes (b) No
  7. 7.🎯 Which sign starts an id selector? (a) . (b) # (c) & (d) @
  8. 8.True or false: margin is the gap to other boxes. (a) False (b) True
  9. 9.⚖️ What colour is the text of this element?
    <h1 class="star" id="hero">Hi</h1>
    CSS:
    #hero { color: black; }
    .star { color: blue; }
    h1 { color: green; }
    (a) black (b) blue (c) orange (d) green
  10. 10.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 60px;
      padding: 20px;
      border: 2px solid black;
      margin: 10px;
    }
  11. 11.Which of these does CSS do? (a) reacts to a button click (b) makes a form box (c) rounds box corners (d) makes headings and lists
  12. 12.True or false: margin is a solid or dotted edge. (a) False (b) True
  13. 13.🖌️ What colour are the letters?
    p {
      color: orange;
      background-color: purple;
      text-align: right;
      font-size: 24px;
    }
    (a) purple (b) red (c) orange
  14. 14.True or false: padding is the gap round content. (a) False (b) True
  15. 15.🖌️ What colour are the letters?
    li {
      text-align: center;
      background-color: black;
      color: white;
      font-size: 16px;
    }
    (a) red (b) black (c) white
  16. 16.🔍 Which is the odd one out? (a) makes headings and lists (b) gives the page structure (c) makes a form box (d) sets colours and fonts
  17. 17.✍️ CSS declarations go inside which brackets? (a) < > (b) { } (c) ( ) (d) [ ]
  18. 18.Which of these does JavaScript do? (a) makes headings and lists (b) changes the text size (c) checks a quiz answer (d) lays out the page
  19. 19.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 140px;
      padding: 15px;
      border: 1px solid black;
      margin: 20px;
    }
  20. 20.⚖️ Which selector is the weakest? (a) a class selector (b) an element selector (c) an id selector
  21. 21.⚖️ What colour is the text of this element?
    <p class="star" id="top">Hi</p>
    CSS:
    .star { color: orange; }
    p { color: blue; }
    (a) orange (b) blue (c) green (d) white
  22. 22.True or false: JavaScript adds space around boxes. (a) False (b) True
  23. 23.🎯 Which sign starts a class selector? (a) @ (b) & (c) # (d) .
  24. 24.🌈 Which colour of light is strongest in rgb(162, 71, 53)? (a) red (b) green (c) blue
  25. 25.🎯 Which CSS selector matches this element?
    <h1 class="note" id="end">Hello</h1>
    (a) h2 (b) #note (c) .big (d) h1
  26. 26.Which of these does CSS do? (a) makes headings and lists (b) makes a link (c) changes the page live (d) adds space around boxes
  27. 27.✍️ What value is given to border in this rule?
    li {
      text-align: center;
      border: 2px solid;
    }
    (a) 2px solid (b) border (c) italic (d) 300px
  28. 28.🧩 Which language checks a quiz answer? (a) CSS (b) JavaScript (c) HTML
  29. 29.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 240px;
      justify-content: center;
    }
    Inside are 3 boxes, each 60px wide (no margins).
  30. 30.⚖️ What colour is the text of this element?
    <p class="star" id="top">Hi</p>
    CSS:
    p { color: blue; }
    p { color: purple; }
    (a) yellow (b) blue (c) green (d) purple
  31. 31.📱 max-width: 600px applies when the screen is ___. (a) 600px or narrower (b) exactly 1000px (c) turned off (d) 600px or wider
  32. 32.✍️ Which property is set to yellow in this rule?
    h2 {
      font-size: 20px;
      background-color: yellow;
      font-style: italic;
      margin: 10px;
    }
    (a) margin (b) yellow (c) background-color (d) padding
  33. 33.🎯 Which element does the selector div style? (a) <p class="red"> (b) <h1 id="logo"> (c) <div class="red"> (d) <span>
  34. 34.True or false: JavaScript puts a picture on a page. (a) True (b) False
  35. 35.What does background-color do? (a) makes the text bold (b) centres a heading (c) colours behind the text (d) sets the letter colour
  36. 36.🌈 Hex digits go 0 to 9, then A to which letter? (a) F (b) Z (c) J (d) G
  37. 37.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 22px;
      }
    }
    (a) Yes (b) No
  38. 38.✍️ Which property is set to 8px in this rule?
    .note {
      font-weight: bold;
      padding: 8px;
    }
    (a) padding (b) border (c) font-weight (d) 8px
  39. 39.Which of these is the border? (a) the gap round content (b) space inside the border (c) space outside the border (d) the line round the box
  40. 40.True or false: padding is space inside the border. (a) False (b) True

Answer key

  1. False
  2. h1
  3. an id selector
  4. <style>
  5. #ffff00
  6. No
  7. #
  8. True
  9. black
  10. 124
  11. rounds box corners
  12. False
  13. orange
  14. True
  15. white
  16. sets colours and fonts
  17. { }
  18. checks a quiz answer
  19. 172
  20. an element selector
  21. orange
  22. False
  23. .
  24. red
  25. h1
  26. adds space around boxes
  27. 2px solid
  28. JavaScript
  29. 30
  30. purple
  31. 600px or narrower
  32. background-color
  33. <div class="red">
  34. False
  35. colours behind the text
  36. F
  37. Yes
  38. padding
  39. the line round the box
  40. True

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