← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 994 · 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 does JavaScript do? (a) adds space around boxes (b) sets colours and fonts (c) counts down a timer (d) makes a link
  2. 2.True or false: JavaScript puts a picture on a page. (a) False (b) True
  3. 3.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 18px;
      }
    }
    (a) No (b) Yes
  4. 4.✍️ Which sign ends each CSS declaration? (a) : (b) ; (c) , (d) .
  5. 5.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the shorter one (b) neither (c) the later one (d) the first one
  6. 6.🌈 Which colour is #00ffff? (a) white (b) cyan (c) black (d) bright green
  7. 7.🖌️ What colour are the letters?
    h1 {
      text-align: left;
      background-color: white;
      color: red;
      font-size: 24px;
    }
    (a) red (b) green (c) white
  8. 8.What does justify-content: flex-end do? (a) packs boxes at the start (b) puts boxes in the middle (c) equal gaps, none at ends (d) packs boxes at the end
  9. 9.🎯 Which element does the selector h1 style? (a) <li class="red"> (b) <div id="intro"> (c) <h2> (d) <h1 class="red">
  10. 10.🌈 Which colour is #ff0000? (a) blue (b) black (c) red (d) white
  11. 11.🖌️ Which CSS property colours behind the text? (a) background-color (b) font-weight (c) text-align (d) font-size
  12. 12.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 170px;
      padding: 20px;
      border: 2px solid black;
      margin: 20px;
    }
  13. 13.✍️ What is the selector in this CSS rule?
    .box {
      width: 300px;
      color: red;
      border: 2px solid;
      padding: 8px;
    }
    (a) .box (b) red (c) h2 (d) width
  14. 14.⚖️ What colour is the text of this element?
    <p class="note" id="intro">Hi</p>
    CSS:
    p { color: purple; }
    p { color: white; }
    (a) purple (b) white (c) black (d) green
  15. 15.🔍 Which is the odd one out? (a) reacts to a button click (b) changes the page live (c) checks a quiz answer (d) makes a link
  16. 16.📦 In the box model, which part is space inside the border? (a) content (b) padding (c) border (d) margin
  17. 17.What does background-color do? (a) makes letters bigger (b) colours behind the text (c) picks the font style (d) sets the letter colour
  18. 18.🎯 Which element does the selector .star style? (a) <p class="menu"> (b) <h1 class="note"> (c) <p class="star"> (d) <p id="star">
  19. 19.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 110px;
      padding: 10px;
      border: 3px solid black;
      margin: 10px;
    }
  20. 20.🎨 One CSS file can style how many pages? (a) only one word (b) no pages (c) many pages (d) only one image
  21. 21.🌈 Which hex code is red? (a) #000000 (b) #00ffff (c) #ff0000 (d) #00ff00
  22. 22.🌈 Which hex code is magenta? (a) #ffffff (b) #ff00ff (c) #00ff00 (d) #ff0000
  23. 23.🎯 What kind of selector is li? (a) a class selector (b) an id selector (c) an element selector
  24. 24.True or false: CSS reacts to a button click. (a) True (b) False
  25. 25.What does font-size do? (a) picks the font style (b) colours behind the text (c) makes letters bigger (d) sets the letter colour
  26. 26.📱 The screen is 1366px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 18px;
      }
    }
    (a) No (b) Yes
  27. 27.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 400px;
      justify-content: center;
    }
    Inside are 3 boxes, each 100px wide (no margins).
  28. 28.🖌️ Where does the text sit on its line?
    h2 {
      text-align: left;
      color: purple;
      font-size: 40px;
      background-color: red;
    }
    (a) on the right (b) in the middle (c) on the left
  29. 29.⚖️ What colour is the text of this element?
    <h1 class="star" id="top">Hi</h1>
    CSS:
    #top { color: green; }
    #top { color: purple; }
    (a) green (b) red (c) purple (d) blue
  30. 30.✍️ What value is given to padding in this rule?
    p {
      color: red;
      padding: 8px;
    }
    (a) 8px (b) bold (c) padding (d) 2px solid
  31. 31.✍️ What value is given to background-color in this rule?
    h1 {
      font-weight: bold;
      background-color: yellow;
    }
    (a) background-color (b) 10px (c) 8px (d) yellow
  32. 32.📱 min-width: 800px applies when the screen is ___. (a) exactly 100px (b) turned off (c) 800px or wider (d) 800px or narrower
  33. 33.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 110px;
      padding: 25px;
      border: 4px solid black;
      margin: 0px;
    }
  34. 34.🌈 In #rrggbb, which colour do the last two digits give? (a) red (b) blue (c) green (d) white
  35. 35.🎯 Which sign starts an id selector? (a) # (b) @ (c) . (d) &
  36. 36.📱 The screen is 820px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 14px;
      }
    }
    (a) Yes (b) No
  37. 37.🖌️ What colour is behind the letters?
    p {
      text-align: left;
      background-color: yellow;
      font-size: 36px;
      color: green;
    }
    (a) black (b) yellow (c) green
  38. 38.🎯 Which CSS selector matches this element?
    <div class="menu" id="top">Hello</div>
    (a) .note (b) div (c) #intro (d) span
  39. 39.🖌️ What colour is behind the letters?
    h2 {
      background-color: green;
      text-align: left;
      color: black;
      font-size: 40px;
    }
    (a) white (b) black (c) green
  40. 40.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 20px;
      }
    }

Answer key

  1. counts down a timer
  2. False
  3. Yes
  4. ;
  5. the later one
  6. cyan
  7. red
  8. packs boxes at the end
  9. <h1 class="red">
  10. red
  11. background-color
  12. 254
  13. .box
  14. white
  15. makes a link
  16. padding
  17. colours behind the text
  18. <p class="star">
  19. 156
  20. many pages
  21. #ff0000
  22. #ff00ff
  23. an element selector
  24. False
  25. makes letters bigger
  26. Yes
  27. 50
  28. on the left
  29. purple
  30. 8px
  31. yellow
  32. 800px or wider
  33. 168
  34. blue
  35. #
  36. No
  37. yellow
  38. div
  39. green
  40. 16

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