← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 488 · 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 element does the selector .red style? (a) <h2 id="red"> (b) <li class="star"> (c) <h2 class="red"> (d) <h2 class="box">
  2. 2.🌈 Which colour of light is strongest in rgb(239, 76, 38)? (a) blue (b) green (c) red
  3. 3.✍️ Which property is set to bold in this rule?
    p {
      color: red;
      font-weight: bold;
      padding: 8px;
    }
    (a) width (b) border (c) font-weight (d) bold
  4. 4.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 160px;
      padding: 25px;
      border: 3px solid black;
      margin: 0px;
    }
  5. 5.🎯 Which CSS selector matches this element?
    <div class="note" id="end">Hello</div>
    (a) .end (b) span (c) div (d) #hero
  6. 6.⚖️ What colour is the text of this element?
    <h1 class="menu" id="main">Hi</h1>
    CSS:
    .menu { color: green; }
    #main { color: black; }
    (a) black (b) green (c) yellow (d) red
  7. 7.✍️ How many declarations (property: value pairs) are in this rule?
    p {
      text-align: center;
      border: 2px solid;
      width: 300px;
      margin: 10px;
    }
  8. 8.✍️ Which property is set to 20px in this rule?
    #top {
      font-style: italic;
      font-size: 20px;
    }
    (a) background-color (b) text-align (c) 20px (d) font-size
  9. 9.🌈 In #rrggbb, which colour do the first two digits give? (a) blue (b) green (c) red (d) black
  10. 10.⚖️ 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
  11. 11.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 20px;
      }
    }
  12. 12.🌈 Which colour of light is strongest in rgb(239, 116, 23)? (a) blue (b) red (c) green
  13. 13.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 16px;
      }
    }
    (a) Yes (b) No
  14. 14.🎯 What kind of selector is .note? (a) an id selector (b) an element selector (c) a class selector
  15. 15.What does justify-content: space-between do? (a) equal gaps, none at ends (b) packs boxes at the start (c) puts boxes in the middle (d) packs boxes at the end
  16. 16.✍️ Which sign ends each CSS declaration? (a) . (b) : (c) ; (d) ,
  17. 17.✍️ Which property is set to italic in this rule?
    .note {
      border: 2px solid;
      font-size: 20px;
      font-style: italic;
    }
    (a) italic (b) color (c) font-size (d) font-style
  18. 18.🖌️ Which CSS property centres a heading? (a) background-color (b) text-align (c) color (d) font-weight
  19. 19.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 16px;
      }
    }
  20. 20.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 170px;
      padding: 20px;
      border: 1px solid black;
      margin: 0px;
    }
  21. 21.✍️ In color: blue; which part is the value? (a) color (b) ; (c) : (d) blue
  22. 22.🌈 In #00e700 the green part is the hex number e7. What is it as a normal number?
  23. 23.🎯 Which CSS selector matches this element?
    <li class="big" id="logo">Hello</li>
    (a) .logo (b) div (c) li (d) #end
  24. 24.✍️ CSS declarations go inside which brackets? (a) { } (b) < > (c) [ ] (d) ( )
  25. 25.🎯 Which sign starts an id selector? (a) . (b) & (c) # (d) @
  26. 26.🖌️ How big is the text, in px?
    h1 {
      font-size: 24px;
      text-align: left;
      background-color: green;
      color: white;
    }
  27. 27.🖌️ Which CSS property sets the letter colour? (a) font-size (b) font-weight (c) background-color (d) color
  28. 28.True or false: padding is a solid or dotted edge. (a) False (b) True
  29. 29.🖌️ What colour are the letters?
    h2 {
      color: black;
      background-color: white;
      font-size: 12px;
      text-align: center;
    }
    (a) white (b) blue (c) black
  30. 30.🎯 Which CSS selector matches this element?
    <div class="menu" id="main">Hello</div>
    (a) span (b) #menu (c) .main (d) div
  31. 31.Which of these is margin? (a) the line round the box (b) space outside the border (c) the gap round content (d) a solid or dotted edge
  32. 32.⚖️ What colour is the text of this element?
    <h1 class="note" id="end">Hi</h1>
    CSS:
    h1 { color: yellow; }
    h1 { color: orange; }
    (a) blue (b) orange (c) yellow (d) green
  33. 33.✍️ What value is given to width in this rule?
    body {
      width: 300px;
      padding: 8px;
    }
    (a) 300px (b) red (c) width (d) italic
  34. 34.🔍 Which is the odd one out? (a) checks a quiz answer (b) lays out the page (c) changes the text size (d) adds space around boxes
  35. 35.📱 max-width: 600px applies when the screen is ___. (a) turned off (b) 600px or wider (c) 600px or narrower (d) exactly 1000px
  36. 36.🖌️ Where does the text sit on its line?
    p {
      text-align: left;
      color: yellow;
      font-size: 24px;
      background-color: white;
    }
    (a) in the middle (b) on the left (c) on the right
  37. 37.📱 The screen is 820px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 14px;
      }
    }
    (a) No (b) Yes
  38. 38.⚖️ What colour is the text of this element?
    <p class="box" id="end">Hi</p>
    CSS:
    p { color: blue; }
    #end { color: yellow; }
    (a) orange (b) yellow (c) blue (d) black
  39. 39.✍️ What is the selector in this CSS rule?
    h1 {
      border: 2px solid;
      font-size: 20px;
      color: red;
      margin: 10px;
    }
    (a) p (b) border (c) 20px (d) h1
  40. 40.Which of these is the content? (a) space inside the border (b) the text or picture (c) space outside the border (d) a solid or dotted edge

Answer key

  1. <h2 class="red">
  2. red
  3. font-weight
  4. 216
  5. div
  6. black
  7. 4
  8. font-size
  9. red
  10. the later one
  11. 24
  12. red
  13. Yes
  14. a class selector
  15. equal gaps, none at ends
  16. ;
  17. font-style
  18. text-align
  19. 12
  20. 212
  21. blue
  22. 231
  23. li
  24. { }
  25. #
  26. 24
  27. color
  28. False
  29. black
  30. div
  31. space outside the border
  32. orange
  33. 300px
  34. checks a quiz answer
  35. 600px or narrower
  36. on the left
  37. Yes
  38. yellow
  39. h1
  40. the text or picture

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