← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 955 · 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 CSS property picks the font style? (a) font-family (b) font-size (c) color (d) text-align
  2. 2.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 12px;
      }
    }
  3. 3.🌈 Which colour is #00ff00? (a) magenta (b) cyan (c) red (d) bright green
  4. 4.What does font-weight do? (a) makes the text bold (b) picks the font style (c) sets the letter colour (d) makes letters bigger
  5. 5.🖌️ What colour are the letters?
    p {
      font-size: 32px;
      text-align: left;
      background-color: orange;
      color: purple;
    }
    (a) orange (b) purple (c) yellow
  6. 6.🎯 Can many elements share the same class? (a) Yes (b) No
  7. 7.💪 Which justify-content value packs boxes at the start? (a) center (b) flex-start (c) space-between (d) flex-end
  8. 8.🔍 Which is the odd one out? (a) rounds box corners (b) makes headings and lists (c) makes a link (d) gives the page structure
  9. 9.🔍 Which is the odd one out? (a) makes a link (b) adds space around boxes (c) rounds box corners (d) sets colours and fonts
  10. 10.⚖️ Which selector is the strongest? (a) an id selector (b) a class selector (c) an element selector
  11. 11.🌈 Which hex code is white? (a) #ff00ff (b) #ff0000 (c) #000000 (d) #ffffff
  12. 12.🎨 Which tag holds CSS inside the head? (a) <css> (b) <body> (c) <script> (d) <style>
  13. 13.🌈 Which colour of light is strongest in rgb(191, 136, 103)? (a) green (b) red (c) blue
  14. 14.⚖️ What colour is the text of this element?
    <h1 class="menu" id="end">Hi</h1>
    CSS:
    #end { color: yellow; }
    #end { color: red; }
    (a) yellow (b) white (c) green (d) red
  15. 15.🎯 Which element does the selector div style? (a) <p class="big"> (b) <h1 id="intro"> (c) <div class="big"> (d) <span>
  16. 16.🎯 Which element does the selector #top style? (a) <p class="top"> (b) <h1 class="star"> (c) <p id="intro"> (d) <p id="top">
  17. 17.📱 The screen is 414px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 10px;
      }
    }
    (a) Yes (b) No
  18. 18.🎯 Which CSS selector matches this element?
    <h2 class="big" id="logo">Hello</h2>
    (a) #big (b) li (c) #end (d) h2
  19. 19.🎯 Which element does the selector #intro style? (a) <span class="intro"> (b) <span id="main"> (c) <span id="intro"> (d) <p class="menu">
  20. 20.What does color do? (a) makes the text bold (b) sets the letter colour (c) makes letters bigger (d) centres a heading
  21. 21.🖌️ What colour is behind the letters?
    h2 {
      background-color: white;
      text-align: center;
      font-size: 24px;
      color: green;
    }
    (a) white (b) green (c) red
  22. 22.✍️ Which sign goes between a property and its value? (a) - (b) ; (c) = (d) :
  23. 23.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 260px;
      justify-content: flex-end;
    }
    Inside are 4 boxes, each 50px wide (no margins).
  24. 24.📦 In the box model, which part is the gap to other boxes? (a) content (b) padding (c) border (d) margin
  25. 25.🌈 Which colour of light is strongest in rgb(191, 130, 74)? (a) green (b) red (c) blue
  26. 26.✍️ Which property is set to 20px in this rule?
    p {
      font-size: 20px;
      border: 2px solid;
    }
    (a) background-color (b) font-size (c) text-align (d) 20px
  27. 27.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 14px;
      }
    }
    (a) No (b) Yes
  28. 28.🖌️ Where does the text sit on its line?
    h2 {
      text-align: center;
      font-size: 40px;
      color: purple;
      background-color: black;
    }
    (a) in the middle (b) on the right (c) on the left
  29. 29.True or false: p is a class selector. (a) True (b) False
  30. 30.🎯 What kind of selector is #main? (a) an element selector (b) an id selector (c) a class selector
  31. 31.✍️ What value is given to background-color in this rule?
    h1 {
      background-color: yellow;
      font-style: italic;
      font-size: 20px;
    }
    (a) 8px (b) yellow (c) background-color (d) 10px
  32. 32.⚖️ What colour is the text of this element?
    <p class="box" id="hero">Hi</p>
    CSS:
    .box { color: purple; }
    p { color: white; }
    (a) purple (b) green (c) white (d) red
  33. 33.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 130px;
      padding: 25px;
      border: 3px solid black;
      margin: 15px;
    }
  34. 34.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 210px;
      padding: 5px;
      border: 4px solid black;
      margin: 15px;
    }
  35. 35.✍️ What value is given to padding in this rule?
    p {
      padding: 8px;
      border: 2px solid;
      text-align: center;
    }
    (a) bold (b) padding (c) 8px (d) 2px solid
  36. 36.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 180px;
      padding: 10px;
      border: 3px solid black;
      margin: 20px;
    }
  37. 37.What does justify-content: flex-start do? (a) packs boxes at the start (b) puts boxes in the middle (c) packs boxes at the end (d) equal gaps, none at ends
  38. 38.🧩 Which language puts a picture on a page? (a) HTML (b) CSS (c) JavaScript
  39. 39.📦 In the box model, which part is the gap round content? (a) margin (b) border (c) padding (d) content
  40. 40.🖌️ How big is the text, in px?
    h2 {
      text-align: left;
      color: purple;
      font-size: 28px;
      background-color: black;
    }

Answer key

  1. font-family
  2. 16
  3. bright green
  4. makes the text bold
  5. purple
  6. Yes
  7. flex-start
  8. rounds box corners
  9. makes a link
  10. an id selector
  11. #ffffff
  12. <style>
  13. red
  14. red
  15. <div class="big">
  16. <p id="top">
  17. Yes
  18. h2
  19. <span id="intro">
  20. sets the letter colour
  21. white
  22. :
  23. 60
  24. margin
  25. red
  26. font-size
  27. Yes
  28. in the middle
  29. False
  30. an id selector
  31. yellow
  32. purple
  33. 216
  34. 258
  35. 8px
  36. 246
  37. packs boxes at the start
  38. HTML
  39. padding
  40. 28

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