← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 853 · 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 flexbox property picks row or column? (a) gap (b) display: flex (c) align-items (d) flex-direction
  2. 2.⚖️ What colour is the text of this element?
    <p class="note" id="intro">Hi</p>
    CSS:
    p { color: green; }
    p { color: yellow; }
    (a) green (b) purple (c) black (d) yellow
  3. 3.🎯 Which element does the selector h2 style? (a) <li> (b) <div class="big"> (c) <h2 class="big"> (d) <span id="hero">
  4. 4.True or false: the border is the text or picture. (a) False (b) True
  5. 5.🌈 Which colour is rgb(0, 0, 255)? (a) black (b) cyan (c) blue (d) bright green
  6. 6.📦 In the box model, which part is space inside the border? (a) border (b) padding (c) margin (d) content
  7. 7.What does justify-content: center 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
  8. 8.True or false: #hero is a class selector. (a) True (b) False
  9. 9.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 100px;
      padding: 30px;
      border: 1px solid black;
      margin: 0px;
    }
  10. 10.💪 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).
  11. 11.✍️ Which property is set to 10px in this rule?
    .note {
      color: red;
      margin: 10px;
      border: 2px solid;
      text-align: center;
    }
    (a) 10px (b) margin (c) font-weight (d) padding
  12. 12.⚖️ Which selector is the strongest? (a) an element selector (b) a class selector (c) an id selector
  13. 13.🎨 Which tag holds CSS inside the head? (a) <script> (b) <body> (c) <css> (d) <style>
  14. 14.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 270px;
      justify-content: flex-end;
    }
    Inside are 4 boxes, each 60px wide (no margins).
  15. 15.✍️ Which sign ends each CSS declaration? (a) ; (b) , (c) : (d) .
  16. 16.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the shorter one (b) the first one (c) neither (d) the later one
  17. 17.🎯 Which element does the selector div style? (a) <p class="note"> (b) <div class="note"> (c) <span> (d) <h1 id="logo">
  18. 18.🖌️ What colour are the letters?
    h1 {
      color: green;
      font-size: 40px;
      background-color: black;
      text-align: center;
    }
    (a) purple (b) black (c) green
  19. 19.🎯 Which CSS selector matches this element?
    <h2 class="red" id="intro">Hello</h2>
    (a) #main (b) .intro (c) h2 (d) .box
  20. 20.🧩 Which language adds space around boxes? (a) CSS (b) JavaScript (c) HTML
  21. 21.✍️ In color: blue; which part is the property? (a) color (b) ; (c) blue (d) :
  22. 22.Which of these is the content? (a) space inside the border (b) the gap round content (c) a solid or dotted edge (d) the text or picture
  23. 23.🔍 Which is the odd one out? (a) rounds box corners (b) gives the page structure (c) makes a link (d) puts a picture on a page
  24. 24.🌈 Which colour is #ff0000? (a) black (b) yellow (c) red (d) cyan
  25. 25.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 28px;
      }
    }
    (a) Yes (b) No
  26. 26.🖌️ How big is the text, in px?
    h2 {
      text-align: center;
      color: green;
      font-size: 40px;
      background-color: black;
    }
  27. 27.Which of these is the border? (a) space outside the border (b) the gap to other boxes (c) a solid or dotted edge (d) space inside the border
  28. 28.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 30px;
      }
    }
    (a) Yes (b) No
  29. 29.📱 The screen is 820px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 30px;
      }
    }
    (a) Yes (b) No
  30. 30.🖌️ What colour is behind the letters?
    h2 {
      background-color: white;
      text-align: left;
      color: green;
      font-size: 40px;
    }
    (a) white (b) yellow (c) green
  31. 31.🎯 Which sign starts an id selector? (a) & (b) # (c) . (d) @
  32. 32.🎨 A CSS file usually ends with which extension? (a) .js (b) .png (c) .html (d) .css
  33. 33.🖌️ What colour is behind the letters?
    h2 {
      text-align: right;
      color: purple;
      background-color: blue;
      font-size: 24px;
    }
    (a) purple (b) white (c) blue
  34. 34.🌈 Which colour of light is strongest in rgb(18, 188, 66)? (a) red (b) blue (c) green
  35. 35.🖌️ What colour is behind the letters?
    p {
      text-align: right;
      color: black;
      font-size: 32px;
      background-color: white;
    }
    (a) black (b) yellow (c) white
  36. 36.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 3 (b) 6 (c) 4 (d) 2
  37. 37.⚖️ What colour is the text of this element?
    <h1 class="menu" id="top">Hi</h1>
    CSS:
    h1 { color: black; }
    h1 { color: green; }
    (a) white (b) black (c) blue (d) green
  38. 38.🖌️ How big is the text, in px?
    p {
      text-align: right;
      color: white;
      font-size: 16px;
      background-color: black;
    }
  39. 39.📱 The screen is 1100px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 14px;
      }
    }
    (a) Yes (b) No
  40. 40.📱 Responsive design means a page ___. (a) fits every screen (b) is only for laptops (c) has no pictures (d) never changes

Answer key

  1. flex-direction
  2. yellow
  3. <h2 class="big">
  4. False
  5. blue
  6. padding
  7. puts boxes in the middle
  8. False
  9. 162
  10. 60
  11. margin
  12. an id selector
  13. <style>
  14. 30
  15. ;
  16. the later one
  17. <div class="note">
  18. green
  19. h2
  20. CSS
  21. color
  22. the text or picture
  23. rounds box corners
  24. red
  25. No
  26. 40
  27. a solid or dotted edge
  28. No
  29. Yes
  30. white
  31. #
  32. .css
  33. blue
  34. green
  35. white
  36. 3
  37. green
  38. 16
  39. No
  40. fits every screen

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