← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 78 · 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 is the odd one out? (a) checks a quiz answer (b) reacts to a button click (c) changes the text size (d) counts down a timer
  2. 2.🖌️ What colour is behind the letters?
    h2 {
      background-color: blue;
      color: orange;
      text-align: left;
      font-size: 12px;
    }
    (a) orange (b) red (c) blue
  3. 3.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 200px;
      padding: 30px;
      border: 2px solid black;
      margin: 15px;
    }
  4. 4.✍️ What is the selector in this CSS rule?
    .note {
      text-align: center;
      color: red;
      margin: 10px;
      width: 300px;
    }
    (a) red (b) .note (c) #top (d) text-align
  5. 5.⚖️ 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
  6. 6.🌈 Which colour of light is strongest in rgb(171, 71, 33)? (a) blue (b) red (c) green
  7. 7.🎯 Which element does the selector li style? (a) <span class="big"> (b) <div> (c) <li class="big"> (d) <p id="hero">
  8. 8.🎯 Which sign starts a class selector? (a) # (b) @ (c) & (d) .
  9. 9.🎯 Which CSS selector matches this element?
    <p class="note" id="top">Hello</p>
    (a) #note (b) #intro (c) #top (d) .big
  10. 10.🎯 Which element does the selector div style? (a) <span> (b) <div class="note"> (c) <p class="note"> (d) <h1 id="hero">
  11. 11.📱 max-width: 600px applies when the screen is ___. (a) turned off (b) 600px or narrower (c) 600px or wider (d) exactly 1000px
  12. 12.🖌️ What colour is behind the letters?
    p {
      text-align: right;
      font-size: 16px;
      color: black;
      background-color: white;
    }
    (a) green (b) black (c) white
  13. 13.🎨 What does CSS stand for? (a) Creative Sheet System (b) Computer Style Sheets (c) Colourful Site Styles (d) Cascading Style Sheets
  14. 14.🧩 Which language makes a form box? (a) CSS (b) HTML (c) JavaScript
  15. 15.⚖️ What colour is the text of this element?
    <h2 class="note" id="top">Hi</h2>
    CSS:
    h2 { color: purple; }
    h2 { color: blue; }
    (a) blue (b) orange (c) black (d) purple
  16. 16.True or false: .note is an id selector. (a) False (b) True
  17. 17.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 28px;
      }
    }
  18. 18.Which of these is padding? (a) the line round the box (b) space inside the border (c) the gap to other boxes (d) the text or picture
  19. 19.🌈 Which colour is #ffffff? (a) bright green (b) red (c) yellow (d) white
  20. 20.🖌️ How big is the text, in px?
    p {
      text-align: left;
      color: purple;
      background-color: orange;
      font-size: 32px;
    }
  21. 21.🖌️ Which CSS property colours behind the text? (a) text-align (b) font-weight (c) color (d) background-color
  22. 22.True or false: #hero is a class selector. (a) True (b) False
  23. 23.📦 In the box model, which part is the line round the box? (a) margin (b) content (c) padding (d) border
  24. 24.Which of these does JavaScript do? (a) puts a picture on a page (b) rounds box corners (c) reacts to a button click (d) adds space around boxes
  25. 25.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 50px;
      padding: 10px;
      border: 2px solid black;
      margin: 5px;
    }
  26. 26.Which of these is the content? (a) the gap round content (b) the line round the box (c) the text or picture (d) space inside the border
  27. 27.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 120px;
      justify-content: flex-end;
    }
    Inside are 2 boxes, each 40px wide (no margins).
  28. 28.🖌️ What colour is behind the letters?
    p {
      font-size: 36px;
      color: white;
      background-color: yellow;
      text-align: center;
    }
    (a) yellow (b) blue (c) white
  29. 29.🧩 Which language gives the page structure? (a) CSS (b) HTML (c) JavaScript
  30. 30.🖌️ Which CSS property centres a heading? (a) text-align (b) font-family (c) background-color (d) font-weight
  31. 31.🔍 Which is the odd one out? (a) rounds box corners (b) makes a form box (c) makes a link (d) gives the page structure
  32. 32.✍️ What is the selector in this CSS rule?
    li {
      border: 2px solid;
      text-align: center;
      margin: 10px;
      font-size: 20px;
    }
    (a) center (b) li (c) body (d) border
  33. 33.✍️ CSS declarations go inside which brackets? (a) [ ] (b) < > (c) { } (d) ( )
  34. 34.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 170px;
      padding: 30px;
      border: 1px solid black;
      margin: 5px;
    }
  35. 35.🖌️ What colour is behind the letters?
    p {
      color: black;
      text-align: center;
      background-color: purple;
      font-size: 32px;
    }
    (a) blue (b) black (c) purple
  36. 36.🎯 Which element does the selector .red style? (a) <p id="red"> (b) <p class="box"> (c) <h1 class="star"> (d) <p class="red">
  37. 37.⚖️ What colour is the text of this element?
    <h1 class="menu" id="logo">Hi</h1>
    CSS:
    h1 { color: yellow; }
    .menu { color: orange; }
    (a) yellow (b) orange (c) blue (d) black
  38. 38.🎯 What kind of selector is .note? (a) a class selector (b) an element selector (c) an id selector
  39. 39.✍️ What is the selector in this CSS rule?
    body {
      text-align: center;
      width: 300px;
      padding: 8px;
      border: 2px solid;
    }
    (a) 300px (b) body (c) .box (d) text-align
  40. 40.✍️ How many declarations (property: value pairs) are in this rule?
    p {
      color: red;
    }

Answer key

  1. changes the text size
  2. blue
  3. 294
  4. .note
  5. the later one
  6. red
  7. <li class="big">
  8. .
  9. #top
  10. <div class="note">
  11. 600px or narrower
  12. white
  13. Cascading Style Sheets
  14. HTML
  15. blue
  16. False
  17. 28
  18. space inside the border
  19. white
  20. 32
  21. background-color
  22. False
  23. border
  24. reacts to a button click
  25. 84
  26. the text or picture
  27. 40
  28. yellow
  29. HTML
  30. text-align
  31. rounds box corners
  32. li
  33. { }
  34. 242
  35. purple
  36. <p class="red">
  37. orange
  38. a class selector
  39. body
  40. 1

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