← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 896 · 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 of these is padding? (a) space outside the border (b) a solid or dotted edge (c) the gap to other boxes (d) the gap round content
  2. 2.✍️ How many declarations (property: value pairs) are in this rule?
    .note {
      background-color: yellow;
      margin: 10px;
    }
  3. 3.✍️ What value is given to padding in this rule?
    #top {
      font-weight: bold;
      padding: 8px;
    }
    (a) 2px solid (b) 8px (c) padding (d) bold
  4. 4.🎯 Which CSS selector matches this element?
    <div class="big" id="main">Hello</div>
    (a) div (b) #logo (c) .red (d) span
  5. 5.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 4 (b) 2 (c) 3 (d) 6
  6. 6.True or false: JavaScript shows a pop-up message. (a) False (b) True
  7. 7.🌈 In #009e00 the green part is the hex number 9e. What is it as a normal number?
  8. 8.✍️ How many declarations (property: value pairs) are in this rule?
    .box {
      font-size: 20px;
      padding: 8px;
      border: 2px solid;
    }
  9. 9.🎯 Which CSS selector matches this element?
    <li class="menu" id="top">Hello</li>
    (a) .note (b) .top (c) li (d) div
  10. 10.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 170px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 50px wide (no margins).
  11. 11.🖌️ Which CSS property makes letters bigger? (a) color (b) font-weight (c) text-align (d) font-size
  12. 12.🎯 Which CSS selector matches this element?
    <div class="big" id="top">Hello</div>
    (a) #big (b) span (c) #top (d) #intro
  13. 13.✍️ Which property is set to 10px in this rule?
    .box {
      text-align: center;
      margin: 10px;
      font-style: italic;
      font-weight: bold;
    }
    (a) font-weight (b) padding (c) 10px (d) margin
  14. 14.⚖️ What colour is the text of this element?
    <h2 class="menu" id="top">Hi</h2>
    CSS:
    .menu { color: green; }
    .menu { color: yellow; }
    (a) yellow (b) purple (c) green (d) black
  15. 15.📱 Which tag helps phones show a page at the right size? (a) the viewport meta tag (b) the title tag (c) the br tag (d) the hr tag
  16. 16.✍️ What is the selector in this CSS rule?
    h2 {
      color: red;
      background-color: yellow;
    }
    (a) h2 (b) color (c) yellow (d) h1
  17. 17.🌈 Which hex code is white? (a) #ffffff (b) #ff00ff (c) #000000 (d) #0000ff
  18. 18.🔍 Which is the odd one out? (a) makes a form box (b) rounds box corners (c) lays out the page (d) changes the text size
  19. 19.💪 Which justify-content value packs boxes at the end? (a) space-between (b) flex-end (c) center (d) flex-start
  20. 20.💪 Which justify-content value equal gaps, none at ends? (a) center (b) space-between (c) flex-end (d) flex-start
  21. 21.✍️ Which property is set to 300px in this rule?
    body {
      width: 300px;
      font-weight: bold;
      border: 2px solid;
      color: red;
    }
    (a) color (b) 300px (c) font-style (d) width
  22. 22.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 12px;
      }
    }
  23. 23.📱 min-width: 800px applies when the screen is ___. (a) 800px or narrower (b) 800px or wider (c) turned off (d) exactly 100px
  24. 24.What does justify-content: flex-start do? (a) puts boxes in the middle (b) packs boxes at the start (c) packs boxes at the end (d) equal gaps, none at ends
  25. 25.🌈 Which hex code is bright green? (a) #00ffff (b) #0000ff (c) #00ff00 (d) #ffffff
  26. 26.Which of these does CSS do? (a) shows a pop-up message (b) counts down a timer (c) makes a form box (d) rounds box corners
  27. 27.🖌️ How big is the text, in px?
    h2 {
      color: white;
      background-color: purple;
      text-align: right;
      font-size: 12px;
    }
  28. 28.✍️ What is the selector in this CSS rule?
    body {
      padding: 8px;
      font-size: 20px;
    }
    (a) body (b) 20px (c) .box (d) padding
  29. 29.📱 The screen is 820px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 20px;
      }
    }
    (a) Yes (b) No
  30. 30.🖌️ How big is the text, in px?
    h2 {
      background-color: blue;
      color: black;
      text-align: right;
      font-size: 40px;
    }
  31. 31.🎯 Which CSS selector matches this element?
    <p class="box" id="top">Hello</p>
    (a) #intro (b) .box (c) #box (d) h1
  32. 32.🌈 Which colour of light is strongest in rgb(165, 7, 102)? (a) green (b) red (c) blue
  33. 33.✍️ Which sign goes between a property and its value? (a) - (b) ; (c) = (d) :
  34. 34.⚖️ What colour is the text of this element?
    <h1 class="box" id="logo">Hi</h1>
    CSS:
    #logo { color: green; }
    h1 { color: blue; }
    .box { color: yellow; }
    (a) blue (b) black (c) yellow (d) green
  35. 35.✍️ How many declarations (property: value pairs) are in this rule?
    h1 {
      font-size: 20px;
    }
  36. 36.What does text-align do? (a) colours behind the text (b) makes letters bigger (c) makes the text bold (d) centres a heading
  37. 37.What does justify-content: center do? (a) puts boxes in the middle (b) equal gaps, none at ends (c) packs boxes at the start (d) packs boxes at the end
  38. 38.🔍 Which is the odd one out? (a) makes a form box (b) gives the page structure (c) adds space around boxes (d) makes a link
  39. 39.📱 The screen is 1100px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 22px;
      }
    }
    (a) Yes (b) No
  40. 40.🔍 Which is the odd one out? (a) shows a pop-up message (b) changes the text size (c) checks a quiz answer (d) counts down a timer

Answer key

  1. the gap round content
  2. 2
  3. 8px
  4. div
  5. 3
  6. True
  7. 158
  8. 3
  9. li
  10. 70
  11. font-size
  12. #top
  13. margin
  14. yellow
  15. the viewport meta tag
  16. h2
  17. #ffffff
  18. makes a form box
  19. flex-end
  20. space-between
  21. width
  22. 16
  23. 800px or wider
  24. packs boxes at the start
  25. #00ff00
  26. rounds box corners
  27. 12
  28. body
  29. Yes
  30. 40
  31. .box
  32. red
  33. :
  34. green
  35. 1
  36. centres a heading
  37. puts boxes in the middle
  38. adds space around boxes
  39. Yes
  40. changes the text size

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