← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 16 · 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 biggest number one colour can have in rgb()? (a) 255 (b) 1000 (c) 100 (d) 99
  2. 2.🔍 Which is the odd one out? (a) shows a pop-up message (b) lays out the page (c) sets colours and fonts (d) adds space around boxes
  3. 3.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 210px;
      justify-content: flex-start;
    }
    Inside are 3 boxes, each 50px wide (no margins).
  4. 4.⚖️ What colour is the text of this element?
    <h1 class="menu" id="top">Hi</h1>
    CSS:
    #top { color: white; }
    #top { color: black; }
    (a) black (b) orange (c) white (d) red
  5. 5.🎯 Which element does the selector p style? (a) <p class="menu"> (b) <li id="intro"> (c) <h2 class="menu"> (d) <h1>
  6. 6.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 360px;
      justify-content: space-between;
    }
    Inside are 3 boxes, each 80px wide (no margins).
  7. 7.🌈 Which colour is #ff0000? (a) blue (b) cyan (c) red (d) yellow
  8. 8.🎯 Which element does the selector #hero style? (a) <h2 class="hero"> (b) <li class="red"> (c) <h2 id="hero"> (d) <h2 id="top">
  9. 9.🎯 Which CSS selector matches this element?
    <li class="menu" id="end">Hello</li>
    (a) .end (b) div (c) #menu (d) #end
  10. 10.✍️ How many declarations (property: value pairs) are in this rule?
    h2 {
      background-color: yellow;
      margin: 10px;
      font-weight: bold;
      font-style: italic;
    }
  11. 11.🎨 What does CSS stand for? (a) Computer Style Sheets (b) Creative Sheet System (c) Cascading Style Sheets (d) Colourful Site Styles
  12. 12.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 70px;
      padding: 5px;
      border: 3px solid black;
      margin: 15px;
    }
  13. 13.🎯 Which CSS selector matches this element?
    <p class="note" id="intro">Hello</p>
    (a) .intro (b) .big (c) p (d) #main
  14. 14.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 160px;
      padding: 10px;
      border: 1px solid black;
      margin: 5px;
    }
  15. 15.⚖️ What colour is the text of this element?
    <h2 class="big" id="end">Hi</h2>
    CSS:
    h2 { color: yellow; }
    h2 { color: purple; }
    (a) blue (b) white (c) yellow (d) purple
  16. 16.🖌️ What colour are the letters?
    li {
      text-align: right;
      background-color: purple;
      color: white;
      font-size: 28px;
    }
    (a) purple (b) white (c) black
  17. 17.🖌️ Where does the text sit on its line?
    li {
      background-color: white;
      text-align: left;
      font-size: 40px;
      color: blue;
    }
    (a) on the right (b) in the middle (c) on the left
  18. 18.🎯 What kind of selector is img? (a) an element selector (b) an id selector (c) a class selector
  19. 19.✍️ How many declarations (property: value pairs) are in this rule?
    .box {
      padding: 8px;
      font-size: 20px;
    }
  20. 20.🎯 What kind of selector is .card? (a) an element selector (b) an id selector (c) a class selector
  21. 21.🎯 Which sign starts an id selector? (a) . (b) # (c) & (d) @
  22. 22.🎯 Which CSS selector matches this element?
    <p class="red" id="hero">Hello</p>
    (a) #top (b) h1 (c) p (d) .box
  23. 23.Which of these does HTML do? (a) makes a form box (b) sets colours and fonts (c) changes the text size (d) checks a quiz answer
  24. 24.⚖️ Which selector is the strongest? (a) a class selector (b) an element selector (c) an id selector
  25. 25.What does font-weight do? (a) colours behind the text (b) makes the text bold (c) centres a heading (d) makes letters bigger
  26. 26.📱 Responsive design means a page ___. (a) fits every screen (b) is only for laptops (c) has no pictures (d) never changes
  27. 27.True or false: CSS puts a picture on a page. (a) False (b) True
  28. 28.🌈 In #rrggbb, which colour do the first two digits give? (a) green (b) blue (c) red (d) black
  29. 29.💪 Which flexbox property spaces boxes along a row? (a) align-items (b) justify-content (c) gap (d) flex-direction
  30. 30.🎯 Which element does the selector .box style? (a) <div class="star"> (b) <div class="box"> (c) <span class="menu"> (d) <div id="box">
  31. 31.🎯 Which CSS selector matches this element?
    <div class="big" id="hero">Hello</div>
    (a) #top (b) #big (c) .hero (d) .big
  32. 32.Which of these does CSS do? (a) puts a picture on a page (b) rounds box corners (c) makes a link (d) reacts to a button click
  33. 33.🎯 Which element does the selector h2 style? (a) <div class="note"> (b) <li> (c) <h2 class="note"> (d) <span id="hero">
  34. 34.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the first one (b) the shorter one (c) neither (d) the later one
  35. 35.📱 The screen is 700px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 26px;
      }
    }
    (a) No (b) Yes
  36. 36.⚖️ What colour is the text of this element?
    <h2 class="menu" id="logo">Hi</h2>
    CSS:
    h2 { color: black; }
    #logo { color: green; }
    .menu { color: white; }
    (a) green (b) black (c) purple (d) white
  37. 37.📱 The screen is 1366px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 18px;
      }
    }
    (a) Yes (b) No
  38. 38.🎯 What kind of selector is .note? (a) an element selector (b) a class selector (c) an id selector
  39. 39.✍️ Which property is set to 2px solid in this rule?
    h1 {
      border: 2px solid;
      width: 300px;
    }
    (a) 2px solid (b) font-style (c) width (d) border
  40. 40.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 200px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 60px wide (no margins).

Answer key

  1. 255
  2. shows a pop-up message
  3. 60
  4. black
  5. <p class="menu">
  6. 60
  7. red
  8. <h2 id="hero">
  9. #end
  10. 4
  11. Cascading Style Sheets
  12. 116
  13. p
  14. 192
  15. purple
  16. white
  17. on the left
  18. an element selector
  19. 2
  20. a class selector
  21. #
  22. p
  23. makes a form box
  24. an id selector
  25. makes the text bold
  26. fits every screen
  27. False
  28. red
  29. justify-content
  30. <div class="box">
  31. .big
  32. rounds box corners
  33. <h2 class="note">
  34. the later one
  35. Yes
  36. green
  37. No
  38. a class selector
  39. border
  40. 80

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