← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 907 · 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.🌈 In #rrggbb, which colour do the last two digits give? (a) green (b) red (c) white (d) blue
  2. 2.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 50px;
      padding: 30px;
      border: 3px solid black;
      margin: 10px;
    }
  3. 3.💪 Which justify-content value equal gaps, none at ends? (a) flex-start (b) flex-end (c) center (d) space-between
  4. 4.🖌️ What colour is behind the letters?
    li {
      color: yellow;
      text-align: right;
      font-size: 12px;
      background-color: white;
    }
    (a) orange (b) white (c) yellow
  5. 5.✍️ Which sign goes between a property and its value? (a) = (b) - (c) : (d) ;
  6. 6.🔍 Which is the odd one out? (a) adds space around boxes (b) changes the text size (c) makes a link (d) rounds box corners
  7. 7.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 170px;
      padding: 15px;
      border: 5px solid black;
      margin: 20px;
    }
  8. 8.🌈 Which colour is #ff0000? (a) bright green (b) blue (c) cyan (d) red
  9. 9.🌈 Which hex code is cyan? (a) #00ffff (b) #0000ff (c) #ff0000 (d) #ffff00
  10. 10.🧩 Which language checks a quiz answer? (a) CSS (b) JavaScript (c) HTML
  11. 11.📱 max-width: 600px applies when the screen is ___. (a) 600px or wider (b) turned off (c) exactly 1000px (d) 600px or narrower
  12. 12.🎯 Which element does the selector div style? (a) <span> (b) <div class="star"> (c) <p class="star"> (d) <h1 id="intro">
  13. 13.✍️ CSS declarations go inside which brackets? (a) ( ) (b) { } (c) < > (d) [ ]
  14. 14.Which of these is padding? (a) the text or picture (b) a solid or dotted edge (c) the gap to other boxes (d) space inside the border
  15. 15.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 440px;
      justify-content: center;
    }
    Inside are 3 boxes, each 100px wide (no margins).
  16. 16.⚖️ What colour is the text of this element?
    <p class="menu" id="hero">Hi</p>
    CSS:
    p { color: red; }
    p { color: blue; }
    (a) red (b) blue (c) white (d) green
  17. 17.⚖️ Which selector is the weakest? (a) an element selector (b) an id selector (c) a class selector
  18. 18.✍️ What is the selector in this CSS rule?
    h1 {
      font-style: italic;
      text-align: center;
      font-weight: bold;
    }
    (a) p (b) font-style (c) h1 (d) center
  19. 19.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 26px;
      }
    }
  20. 20.💪 Which flexbox property turns on flexbox? (a) align-items (b) display: flex (c) justify-content (d) flex-direction
  21. 21.True or false: padding is space inside the border. (a) False (b) True
  22. 22.📱 The screen is 820px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 14px;
      }
    }
    (a) Yes (b) No
  23. 23.🌈 Which colour is #ff00ff? (a) black (b) yellow (c) magenta (d) blue
  24. 24.⚖️ Two rules with the same selector set a colour. Which one wins? (a) neither (b) the shorter one (c) the first one (d) the later one
  25. 25.🌈 Which colour is #000000? (a) magenta (b) yellow (c) black (d) red
  26. 26.🧩 Which language reacts to a button click? (a) JavaScript (b) CSS (c) HTML
  27. 27.🖌️ What colour is behind the letters?
    li {
      font-size: 40px;
      color: orange;
      text-align: center;
      background-color: blue;
    }
    (a) black (b) blue (c) orange
  28. 28.💪 Which flexbox property sets space between boxes? (a) gap (b) flex-direction (c) justify-content (d) align-items
  29. 29.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 180px;
      padding: 5px;
      border: 2px solid black;
      margin: 10px;
    }
  30. 30.💪 Which flexbox property lines boxes up across? (a) display: flex (b) justify-content (c) gap (d) align-items
  31. 31.True or false: .star is a class selector. (a) True (b) False
  32. 32.🖌️ What colour are the letters?
    h1 {
      font-size: 12px;
      color: orange;
      text-align: left;
      background-color: black;
    }
    (a) orange (b) red (c) black
  33. 33.🌈 Which colour is #ffffff? (a) black (b) red (c) bright green (d) white
  34. 34.What does color do? (a) centres a heading (b) sets the letter colour (c) makes the text bold (d) colours behind the text
  35. 35.✍️ What is the selector in this CSS rule?
    p {
      background-color: yellow;
      font-weight: bold;
      font-style: italic;
    }
    (a) bold (b) p (c) background-color (d) .note
  36. 36.🎯 Can many elements share the same class? (a) Yes (b) No
  37. 37.🌈 In #00002e the blue part is the hex number 2e. What is it as a normal number?
  38. 38.🎯 Which element does the selector p style? (a) <h2 class="menu"> (b) <p class="menu"> (c) <li id="logo"> (d) <h1>
  39. 39.True or false: the border is the gap round content. (a) True (b) False
  40. 40.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 16px;
      }
    }

Answer key

  1. blue
  2. 136
  3. space-between
  4. white
  5. :
  6. makes a link
  7. 250
  8. red
  9. #00ffff
  10. JavaScript
  11. 600px or narrower
  12. <div class="star">
  13. { }
  14. space inside the border
  15. 70
  16. blue
  17. an element selector
  18. h1
  19. 24
  20. display: flex
  21. True
  22. No
  23. magenta
  24. the later one
  25. black
  26. JavaScript
  27. blue
  28. gap
  29. 214
  30. align-items
  31. True
  32. orange
  33. white
  34. sets the letter colour
  35. p
  36. Yes
  37. 46
  38. <p class="menu">
  39. False
  40. 16

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