← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 811 · 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.✍️ What is the selector in this CSS rule?
    #top {
      border: 2px solid;
      color: red;
    }
    (a) red (b) li (c) border (d) #top
  2. 2.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 150px;
      padding: 5px;
      border: 5px solid black;
      margin: 10px;
    }
  3. 3.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 540px;
      justify-content: center;
    }
    Inside are 4 boxes, each 100px wide (no margins).
  4. 4.🖌️ How big is the text, in px?
    h2 {
      text-align: left;
      font-size: 28px;
      color: blue;
      background-color: purple;
    }
  5. 5.🧩 Which language shows a pop-up message? (a) CSS (b) JavaScript (c) HTML
  6. 6.✍️ In color: blue; which part is the value? (a) : (b) ; (c) color (d) blue
  7. 7.🌈 Which colour is rgb(0, 255, 0)? (a) bright green (b) black (c) magenta (d) cyan
  8. 8.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 250px;
      justify-content: flex-start;
    }
    Inside are 4 boxes, each 50px wide (no margins).
  9. 9.🧩 Which language counts down a timer? (a) CSS (b) HTML (c) JavaScript
  10. 10.✍️ Which sign goes between a property and its value? (a) - (b) ; (c) : (d) =
  11. 11.🌈 Which colour of light is strongest in rgb(50, 127, 193)? (a) red (b) green (c) blue
  12. 12.🌈 Which colour is #ffff00? (a) yellow (b) white (c) bright green (d) black
  13. 13.🌈 What is the biggest number one colour can have in rgb()? (a) 99 (b) 100 (c) 1000 (d) 255
  14. 14.🖌️ What colour are the letters?
    li {
      text-align: right;
      color: yellow;
      font-size: 12px;
      background-color: red;
    }
    (a) green (b) red (c) yellow
  15. 15.🎯 Which element does the selector .menu style? (a) <h1 id="menu"> (b) <h2 class="big"> (c) <h1 class="note"> (d) <h1 class="menu">
  16. 16.📱 Which tag helps phones show a page at the right size? (a) the title tag (b) the viewport meta tag (c) the hr tag (d) the br tag
  17. 17.✍️ What value is given to border in this rule?
    #top {
      border: 2px solid;
      color: red;
      font-size: 20px;
      font-weight: bold;
    }
    (a) 300px (b) italic (c) 2px solid (d) border
  18. 18.✍️ What is the selector in this CSS rule?
    body {
      text-align: center;
      padding: 8px;
      margin: 10px;
      font-weight: bold;
    }
    (a) .box (b) body (c) 8px (d) text-align
  19. 19.Which of these does JavaScript do? (a) changes the text size (b) makes headings and lists (c) rounds box corners (d) counts down a timer
  20. 20.Which of these does HTML do? (a) counts down a timer (b) checks a quiz answer (c) lays out the page (d) puts a picture on a page
  21. 21.🌈 In #240000 the red part is the hex number 24. What is it as a normal number?
  22. 22.🧩 Which language checks a quiz answer? (a) HTML (b) CSS (c) JavaScript
  23. 23.⚖️ What colour is the text of this element?
    <p class="menu" id="end">Hi</p>
    CSS:
    .menu { color: yellow; }
    .menu { color: blue; }
    (a) orange (b) yellow (c) blue (d) black
  24. 24.✍️ CSS declarations go inside which brackets? (a) ( ) (b) { } (c) < > (d) [ ]
  25. 25.Which of these does HTML do? (a) sets colours and fonts (b) makes headings and lists (c) shows a pop-up message (d) reacts to a button click
  26. 26.🎯 Which element does the selector p style? (a) <h1> (b) <p class="note"> (c) <h2 class="note"> (d) <li id="main">
  27. 27.✍️ How many declarations (property: value pairs) are in this rule?
    .box {
      border: 2px solid;
      margin: 10px;
      font-style: italic;
      font-size: 20px;
    }
  28. 28.✍️ How many declarations (property: value pairs) are in this rule?
    .note {
      padding: 8px;
    }
  29. 29.🌈 Which hex code is magenta? (a) #ff00ff (b) #00ffff (c) #ffffff (d) #0000ff
  30. 30.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 180px;
      justify-content: center;
    }
    Inside are 4 boxes, each 40px wide (no margins).
  31. 31.Which of these does CSS do? (a) makes headings and lists (b) makes a form box (c) gives the page structure (d) rounds box corners
  32. 32.🎯 Which element does the selector #main style? (a) <h1 class="note"> (b) <p id="logo"> (c) <p id="main"> (d) <p class="main">
  33. 33.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 10px;
      }
    }
  34. 34.🎯 Which element does the selector #intro style? (a) <span class="intro"> (b) <p class="big"> (c) <span id="intro"> (d) <span id="main">
  35. 35.🌈 Which hex code is bright green? (a) #ff0000 (b) #ff00ff (c) #00ffff (d) #00ff00
  36. 36.⚖️ What colour is the text of this element?
    <h2 class="red" id="top">Hi</h2>
    CSS:
    h2 { color: yellow; }
    #top { color: blue; }
    .red { color: white; }
    (a) purple (b) yellow (c) white (d) blue
  37. 37.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 20px;
      }
    }
  38. 38.🌈 Which colour is #ffffff? (a) yellow (b) bright green (c) white (d) blue
  39. 39.🎯 Which CSS selector matches this element?
    <span class="big" id="intro">Hello</span>
    (a) #main (b) .intro (c) p (d) #intro
  40. 40.💪 Which flexbox property lines boxes up across? (a) align-items (b) flex-direction (c) gap (d) display: flex

Answer key

  1. #top
  2. 190
  3. 70
  4. 28
  5. JavaScript
  6. blue
  7. bright green
  8. 50
  9. JavaScript
  10. :
  11. blue
  12. yellow
  13. 255
  14. yellow
  15. <h1 class="menu">
  16. the viewport meta tag
  17. 2px solid
  18. body
  19. counts down a timer
  20. puts a picture on a page
  21. 36
  22. JavaScript
  23. blue
  24. { }
  25. makes headings and lists
  26. <p class="note">
  27. 4
  28. 1
  29. #ff00ff
  30. 10
  31. rounds box corners
  32. <p id="main">
  33. 10
  34. <span id="intro">
  35. #00ff00
  36. blue
  37. 20
  38. white
  39. #intro
  40. align-items

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