← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 594 · 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.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 300px;
      justify-content: center;
    }
    Inside are 4 boxes, each 60px wide (no margins).
  2. 2.🖌️ Which CSS property picks the font style? (a) font-family (b) text-align (c) background-color (d) color
  3. 3.🔍 Which is the odd one out? (a) reacts to a button click (b) checks a quiz answer (c) shows a pop-up message (d) puts a picture on a page
  4. 4.🎯 Which CSS selector matches this element?
    <span class="star" id="hero">Hello</span>
    (a) .star (b) .hero (c) p (d) #star
  5. 5.🎯 Which sign starts an id selector? (a) & (b) # (c) @ (d) .
  6. 6.✍️ In color: blue; which part is the property? (a) blue (b) color (c) : (d) ;
  7. 7.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 100px;
      padding: 30px;
      border: 5px solid black;
      margin: 15px;
    }
  8. 8.True or false: CSS makes a link. (a) True (b) False
  9. 9.🌈 Which colour of light is strongest in rgb(81, 156, 49)? (a) green (b) blue (c) red
  10. 10.🧩 Which language makes a link? (a) CSS (b) JavaScript (c) HTML
  11. 11.⚖️ What colour is the text of this element?
    <h1 class="menu" id="intro">Hi</h1>
    CSS:
    .menu { color: blue; }
    .menu { color: black; }
    (a) orange (b) black (c) blue (d) yellow
  12. 12.🎨 Which tag connects an outside CSS file? (a) <img> (b) <css> (c) <a> (d) <link>
  13. 13.Which of these does HTML do? (a) sets colours and fonts (b) changes the text size (c) counts down a timer (d) puts a picture on a page
  14. 14.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 18px;
      }
    }
  15. 15.Which of these is padding? (a) the text or picture (b) a solid or dotted edge (c) space inside the border (d) the line round the box
  16. 16.🎯 What kind of selector is .star? (a) a class selector (b) an id selector (c) an element selector
  17. 17.🌈 Which colour of light is strongest in rgb(6, 19, 226)? (a) green (b) blue (c) red
  18. 18.🌈 In #4e0000 the red part is the hex number 4e. What is it as a normal number?
  19. 19.✍️ How many declarations (property: value pairs) are in this rule?
    h2 {
      margin: 10px;
      border: 2px solid;
    }
  20. 20.What does justify-content: flex-end do? (a) packs boxes at the start (b) equal gaps, none at ends (c) puts boxes in the middle (d) packs boxes at the end
  21. 21.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 18px;
      }
    }
  22. 22.🌈 Which hex code is white? (a) #ffffff (b) #ff0000 (c) #000000 (d) #00ffff
  23. 23.✍️ What is the selector in this CSS rule?
    h2 {
      background-color: yellow;
      font-style: italic;
      border: 2px solid;
    }
    (a) italic (b) background-color (c) h1 (d) h2
  24. 24.🖌️ Where does the text sit on its line?
    h1 {
      font-size: 24px;
      color: purple;
      text-align: center;
      background-color: orange;
    }
    (a) in the middle (b) on the right (c) on the left
  25. 25.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 14px;
      }
    }
  26. 26.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 12px;
      }
    }
  27. 27.🎯 Which CSS selector matches this element?
    <p class="big" id="hero">Hello</p>
    (a) #top (b) h1 (c) #big (d) #hero
  28. 28.🖌️ What colour are the letters?
    p {
      background-color: green;
      text-align: left;
      color: red;
      font-size: 16px;
    }
    (a) green (b) black (c) red
  29. 29.⚖️ What colour is the text of this element?
    <p class="big" id="intro">Hi</p>
    CSS:
    p { color: purple; }
    p { color: black; }
    (a) purple (b) yellow (c) blue (d) black
  30. 30.💪 Which flexbox property turns on flexbox? (a) align-items (b) justify-content (c) gap (d) display: flex
  31. 31.⚖️ What colour is the text of this element?
    <p class="note" id="main">Hi</p>
    CSS:
    #main { color: orange; }
    #main { color: green; }
    (a) orange (b) black (c) green (d) purple
  32. 32.🎯 Which CSS selector matches this element?
    <li class="menu" id="hero">Hello</li>
    (a) #menu (b) #top (c) #hero (d) .note
  33. 33.🖌️ Which CSS property sets the letter colour? (a) font-size (b) color (c) font-weight (d) background-color
  34. 34.📱 The screen is 414px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 14px;
      }
    }
    (a) No (b) Yes
  35. 35.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 220px;
      justify-content: center;
    }
    Inside are 4 boxes, each 40px wide (no margins).
  36. 36.🌈 In #rrggbb, which colour do the first two digits give? (a) green (b) black (c) blue (d) red
  37. 37.Which of these does CSS do? (a) puts a picture on a page (b) reacts to a button click (c) makes headings and lists (d) sets colours and fonts
  38. 38.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 6px;
      }
    }
    (a) No (b) Yes
  39. 39.⚖️ What colour is the text of this element?
    <h2 class="star" id="end">Hi</h2>
    CSS:
    #end { color: black; }
    .star { color: purple; }
    h2 { color: white; }
    (a) black (b) white (c) purple (d) yellow
  40. 40.What does text-align do? (a) colours behind the text (b) sets the letter colour (c) centres a heading (d) picks the font style

Answer key

  1. 30
  2. font-family
  3. puts a picture on a page
  4. .star
  5. #
  6. color
  7. 170
  8. False
  9. green
  10. HTML
  11. black
  12. <link>
  13. puts a picture on a page
  14. 12
  15. space inside the border
  16. a class selector
  17. blue
  18. 78
  19. 2
  20. packs boxes at the end
  21. 24
  22. #ffffff
  23. h2
  24. in the middle
  25. 14
  26. 12
  27. #hero
  28. red
  29. black
  30. display: flex
  31. green
  32. #hero
  33. color
  34. Yes
  35. 30
  36. red
  37. sets colours and fonts
  38. Yes
  39. black
  40. centres a heading

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