← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 75 · 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.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the later one (b) the first one (c) neither (d) the shorter one
  2. 2.⚖️ What colour is the text of this element?
    <h1 class="note" id="end">Hi</h1>
    CSS:
    #end { color: orange; }
    h1 { color: red; }
    .note { color: green; }
    (a) purple (b) orange (c) green (d) red
  3. 3.🧩 Which language checks a quiz answer? (a) JavaScript (b) CSS (c) HTML
  4. 4.🎯 Which sign starts an id selector? (a) & (b) @ (c) # (d) .
  5. 5.🎯 Which CSS selector matches this element?
    <div class="red" id="end">Hello</div>
    (a) #hero (b) span (c) #end (d) .box
  6. 6.🌈 Which colour of light is strongest in rgb(44, 218, 87)? (a) green (b) red (c) blue
  7. 7.🖌️ Where does the text sit on its line?
    h2 {
      background-color: orange;
      font-size: 28px;
      text-align: left;
      color: green;
    }
    (a) in the middle (b) on the right (c) on the left
  8. 8.🌈 Which colour is rgb(0, 0, 255)? (a) cyan (b) blue (c) bright green (d) red
  9. 9.True or false: the content is the text or picture. (a) False (b) True
  10. 10.✍️ Which property is set to 2px solid in this rule?
    #top {
      border: 2px solid;
      font-weight: bold;
      background-color: yellow;
      width: 300px;
    }
    (a) 2px solid (b) width (c) font-style (d) border
  11. 11.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 170px;
      padding: 25px;
      border: 1px solid black;
      margin: 15px;
    }
  12. 12.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 160px;
      justify-content: flex-end;
    }
    Inside are 2 boxes, each 60px wide (no margins).
  13. 13.⚖️ Which selector is the weakest? (a) a class selector (b) an element selector (c) an id selector
  14. 14.🌈 In #009400 the green part is the hex number 94. What is it as a normal number?
  15. 15.🌈 Which hex code is yellow? (a) #000000 (b) #ffff00 (c) #00ffff (d) #ffffff
  16. 16.True or false: margin is the gap to other boxes. (a) True (b) False
  17. 17.✍️ Which property is set to 10px in this rule?
    li {
      font-size: 20px;
      margin: 10px;
      border: 2px solid;
    }
    (a) 10px (b) font-weight (c) padding (d) margin
  18. 18.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 10px;
      }
    }
  19. 19.✍️ Which sign ends each CSS declaration? (a) , (b) . (c) ; (d) :
  20. 20.✍️ What is the selector in this CSS rule?
    p {
      background-color: yellow;
      color: red;
    }
    (a) background-color (b) p (c) .note (d) red
  21. 21.🌈 In #00dd00 the green part is the hex number dd. What is it as a normal number?
  22. 22.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 200px;
      justify-content: center;
    }
    Inside are 4 boxes, each 40px wide (no margins).
  23. 23.🌈 Which colour is rgb(0, 255, 255)? (a) cyan (b) black (c) blue (d) red
  24. 24.⚖️ What colour is the text of this element?
    <h1 class="note" id="logo">Hi</h1>
    CSS:
    .note { color: white; }
    h1 { color: green; }
    (a) white (b) green (c) red (d) black
  25. 25.🖌️ Where does the text sit on its line?
    h2 {
      color: purple;
      background-color: blue;
      font-size: 28px;
      text-align: center;
    }
    (a) on the left (b) on the right (c) in the middle
  26. 26.🎯 Which sign starts a class selector? (a) . (b) @ (c) # (d) &
  27. 27.⚖️ Which selector is the strongest? (a) a class selector (b) an id selector (c) an element selector
  28. 28.✍️ In color: blue; which part is the value? (a) ; (b) blue (c) color (d) :
  29. 29.🌈 Which colour of light is strongest in rgb(29, 41, 196)? (a) green (b) red (c) blue
  30. 30.Which of these is the border? (a) the gap round content (b) a solid or dotted edge (c) space outside the border (d) space inside the border
  31. 31.🌈 What is the biggest number one colour can have in rgb()? (a) 100 (b) 99 (c) 1000 (d) 255
  32. 32.📱 Responsive design means a page ___. (a) is only for laptops (b) fits every screen (c) has no pictures (d) never changes
  33. 33.🎯 How many elements on a page should have the same id? (a) 1 (b) 5 (c) 2 (d) any number
  34. 34.📦 In the box model, which part is the gap to other boxes? (a) padding (b) margin (c) border (d) content
  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: 50px;
      padding: 25px;
      border: 1px solid black;
      margin: 15px;
    }
  36. 36.💪 Which justify-content value packs boxes at the start? (a) space-between (b) center (c) flex-end (d) flex-start
  37. 37.True or false: the border is a solid or dotted edge. (a) False (b) True
  38. 38.True or false: padding is space outside the border. (a) False (b) True
  39. 39.🧩 Which language makes a form box? (a) CSS (b) HTML (c) JavaScript
  40. 40.⚖️ What colour is the text of this element?
    <h1 class="note" id="hero">Hi</h1>
    CSS:
    .note { color: white; }
    #hero { color: orange; }
    (a) orange (b) blue (c) black (d) white

Answer key

  1. the later one
  2. orange
  3. JavaScript
  4. #
  5. #end
  6. green
  7. on the left
  8. blue
  9. True
  10. border
  11. 252
  12. 40
  13. an element selector
  14. 148
  15. #ffff00
  16. True
  17. margin
  18. 16
  19. ;
  20. p
  21. 221
  22. 20
  23. cyan
  24. white
  25. in the middle
  26. .
  27. an id selector
  28. blue
  29. blue
  30. a solid or dotted edge
  31. 255
  32. fits every screen
  33. 1
  34. margin
  35. 102
  36. flex-start
  37. True
  38. False
  39. HTML
  40. orange

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