← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 207 · 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 many declarations (property: value pairs) are in this rule?
    body {
      border: 2px solid;
      font-style: italic;
      background-color: yellow;
    }
  2. 2.What does justify-content: space-between do? (a) packs boxes at the end (b) puts boxes in the middle (c) packs boxes at the start (d) equal gaps, none at ends
  3. 3.True or false: the content is the text or picture. (a) True (b) False
  4. 4.🌈 Which colour is #ff0000? (a) cyan (b) bright green (c) black (d) red
  5. 5.🌈 Which hex code is black? (a) #ff00ff (b) #000000 (c) #ff0000 (d) #00ffff
  6. 6.True or false: body is an element selector. (a) True (b) False
  7. 7.🌈 In #rrggbb, which colour do the first two digits give? (a) green (b) blue (c) black (d) red
  8. 8.⚖️ What colour is the text of this element?
    <h2 class="big" id="logo">Hi</h2>
    CSS:
    h2 { color: red; }
    h2 { color: blue; }
    (a) black (b) red (c) blue (d) yellow
  9. 9.🎨 Which tag holds CSS inside the head? (a) <style> (b) <css> (c) <script> (d) <body>
  10. 10.What does font-size do? (a) picks the font style (b) makes letters bigger (c) colours behind the text (d) sets the letter colour
  11. 11.What does text-align do? (a) picks the font style (b) sets the letter colour (c) centres a heading (d) makes the text bold
  12. 12.✍️ What is the selector in this CSS rule?
    .note {
      font-style: italic;
      margin: 10px;
      color: red;
    }
    (a) #top (b) 10px (c) .note (d) font-style
  13. 13.🎯 Which sign starts an id selector? (a) . (b) & (c) @ (d) #
  14. 14.🎯 What kind of selector is .note? (a) an element selector (b) an id selector (c) a class selector
  15. 15.🖌️ What colour are the letters?
    h1 {
      background-color: red;
      text-align: center;
      font-size: 20px;
      color: green;
    }
    (a) red (b) green (c) black
  16. 16.💪 Which flexbox property sets space between boxes? (a) display: flex (b) gap (c) flex-direction (d) align-items
  17. 17.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 14px;
      }
    }
    (a) Yes (b) No
  18. 18.⚖️ What colour is the text of this element?
    <h1 class="big" id="intro">Hi</h1>
    CSS:
    #intro { color: yellow; }
    #intro { color: blue; }
    (a) blue (b) yellow (c) green (d) white
  19. 19.🌈 Which hex code is bright green? (a) #ff0000 (b) #ffff00 (c) #ffffff (d) #00ff00
  20. 20.⚖️ What colour is the text of this element?
    <h2 class="red" id="top">Hi</h2>
    CSS:
    .red { color: purple; }
    h2 { color: blue; }
    (a) purple (b) black (c) white (d) blue
  21. 21.🌈 Which hex code is cyan? (a) #000000 (b) #00ffff (c) #00ff00 (d) #ffff00
  22. 22.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the first one (b) neither (c) the later one (d) the shorter one
  23. 23.⚖️ What colour is the text of this element?
    <p class="box" id="logo">Hi</p>
    CSS:
    #logo { color: red; }
    #logo { color: green; }
    (a) yellow (b) white (c) red (d) green
  24. 24.🖌️ How big is the text, in px?
    h1 {
      color: white;
      text-align: center;
      font-size: 24px;
      background-color: purple;
    }
  25. 25.🎨 What does CSS stand for? (a) Creative Sheet System (b) Colourful Site Styles (c) Computer Style Sheets (d) Cascading Style Sheets
  26. 26.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 60px;
      padding: 5px;
      border: 2px solid black;
      margin: 10px;
    }
  27. 27.🌈 Which colour of light is strongest in rgb(183, 74, 13)? (a) green (b) blue (c) red
  28. 28.🌈 In #00002e the blue part is the hex number 2e. What is it as a normal number?
  29. 29.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 130px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 40px wide (no margins).
  30. 30.🧩 Which language reacts to a button click? (a) HTML (b) CSS (c) JavaScript
  31. 31.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 16px;
      }
    }
  32. 32.🖌️ Where does the text sit on its line?
    li {
      text-align: left;
      background-color: yellow;
      font-size: 28px;
      color: green;
    }
    (a) on the left (b) in the middle (c) on the right
  33. 33.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 18px;
      }
    }
    (a) No (b) Yes
  34. 34.💪 Which justify-content value packs boxes at the end? (a) center (b) space-between (c) flex-start (d) flex-end
  35. 35.🌈 Which colour is #0000ff? (a) red (b) yellow (c) blue (d) bright green
  36. 36.🌈 Which hex code is magenta? (a) #0000ff (b) #00ff00 (c) #ff00ff (d) #ff0000
  37. 37.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 380px;
      justify-content: center;
    }
    Inside are 4 boxes, each 60px wide (no margins).
  38. 38.🖌️ What colour are the letters?
    h2 {
      background-color: purple;
      text-align: right;
      color: yellow;
      font-size: 12px;
    }
    (a) black (b) purple (c) yellow
  39. 39.⚖️ What colour is the text of this element?
    <p class="big" id="intro">Hi</p>
    CSS:
    p { color: black; }
    p { color: blue; }
    (a) green (b) red (c) black (d) blue
  40. 40.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 22px;
      }
    }

Answer key

  1. 3
  2. equal gaps, none at ends
  3. True
  4. red
  5. #000000
  6. True
  7. red
  8. blue
  9. <style>
  10. makes letters bigger
  11. centres a heading
  12. .note
  13. #
  14. a class selector
  15. green
  16. gap
  17. No
  18. blue
  19. #00ff00
  20. purple
  21. #00ffff
  22. the later one
  23. green
  24. 24
  25. Cascading Style Sheets
  26. 94
  27. red
  28. 46
  29. 50
  30. JavaScript
  31. 16
  32. on the left
  33. Yes
  34. flex-end
  35. blue
  36. #ff00ff
  37. 70
  38. yellow
  39. blue
  40. 22

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