← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 697 · 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 sets space between boxes? (a) justify-content (b) gap (c) align-items (d) flex-direction
  2. 2.🎯 Which element does the selector #top style? (a) <h1 class="top"> (b) <h2 class="note"> (c) <h1 id="top"> (d) <h1 id="intro">
  3. 3.True or false: .star is a class selector. (a) False (b) True
  4. 4.🔍 Which is the odd one out? (a) adds space around boxes (b) reacts to a button click (c) checks a quiz answer (d) changes the page live
  5. 5.🎯 Which element does the selector .menu style? (a) <li class="big"> (b) <h2 id="menu"> (c) <h2 class="menu"> (d) <h2 class="note">
  6. 6.✍️ In color: blue; which part is the value? (a) : (b) blue (c) color (d) ;
  7. 7.✍️ What value is given to color in this rule?
    .note {
      margin: 10px;
      color: red;
    }
    (a) center (b) red (c) 20px (d) color
  8. 8.🎯 Which CSS selector matches this element?
    <p class="red" id="intro">Hello</p>
    (a) .intro (b) #red (c) #intro (d) .box
  9. 9.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 160px;
      justify-content: flex-end;
    }
    Inside are 2 boxes, each 60px wide (no margins).
  10. 10.✍️ Which property is set to 8px in this rule?
    #top {
      font-weight: bold;
      padding: 8px;
      width: 300px;
      font-size: 20px;
    }
    (a) font-weight (b) border (c) 8px (d) padding
  11. 11.📱 Which tag helps phones show a page at the right size? (a) the title tag (b) the br tag (c) the hr tag (d) the viewport meta tag
  12. 12.🌈 Which colour is rgb(255, 0, 0)? (a) magenta (b) red (c) black (d) cyan
  13. 13.✍️ How does a CSS comment start? (a) // (b) # (c) /* (d) <!--
  14. 14.🎯 Which CSS selector matches this element?
    <h1 class="note" id="end">Hello</h1>
    (a) h2 (b) h1 (c) #note (d) #hero
  15. 15.📱 The screen is 414px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 14px;
      }
    }
    (a) Yes (b) No
  16. 16.True or false: JavaScript checks a quiz answer. (a) False (b) True
  17. 17.📦 In the box model, which part is the line round the box? (a) margin (b) padding (c) border (d) content
  18. 18.🎯 Which CSS selector matches this element?
    <li class="star" id="intro">Hello</li>
    (a) .intro (b) div (c) #intro (d) #star
  19. 19.True or false: .big is an element selector. (a) True (b) False
  20. 20.🖌️ Which CSS property centres a heading? (a) background-color (b) font-weight (c) text-align (d) font-size
  21. 21.✍️ CSS declarations go inside which brackets? (a) < > (b) ( ) (c) [ ] (d) { }
  22. 22.🖌️ What colour are the letters?
    h1 {
      color: white;
      text-align: center;
      font-size: 40px;
      background-color: red;
    }
    (a) purple (b) white (c) red
  23. 23.Which of these does CSS do? (a) adds space around boxes (b) counts down a timer (c) gives the page structure (d) changes the page live
  24. 24.True or false: JavaScript rounds box corners. (a) False (b) True
  25. 25.What does justify-content: space-between 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
  26. 26.✍️ How many declarations (property: value pairs) are in this rule?
    li {
      width: 300px;
      font-size: 20px;
      margin: 10px;
    }
  27. 27.True or false: margin is space outside the border. (a) False (b) True
  28. 28.🖌️ Which CSS property makes letters bigger? (a) font-size (b) color (c) font-family (d) text-align
  29. 29.⚖️ Which selector is the strongest? (a) a class selector (b) an element selector (c) an id selector
  30. 30.⚖️ Which selector is the weakest? (a) an id selector (b) a class selector (c) an element selector
  31. 31.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 16px;
      }
    }
  32. 32.🌈 Which hex code is black? (a) #000000 (b) #ff00ff (c) #ffff00 (d) #ffffff
  33. 33.🧩 Which language rounds box corners? (a) JavaScript (b) HTML (c) CSS
  34. 34.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 20px;
      }
    }
  35. 35.⚖️ What colour is the text of this element?
    <h2 class="star" id="top">Hi</h2>
    CSS:
    .star { color: orange; }
    h2 { color: black; }
    (a) purple (b) orange (c) black (d) yellow
  36. 36.🌈 Which colour of light is strongest in rgb(159, 129, 39)? (a) red (b) blue (c) green
  37. 37.🎯 Which element does the selector .star style? (a) <p id="star"> (b) <p class="menu"> (c) <h1 class="note"> (d) <p class="star">
  38. 38.🌈 Hex digits go 0 to 9, then A to which letter? (a) Z (b) F (c) J (d) G
  39. 39.🎯 What kind of selector is .note? (a) an id selector (b) an element selector (c) a class selector
  40. 40.🖌️ Where does the text sit on its line?
    p {
      text-align: right;
      font-size: 20px;
      background-color: yellow;
      color: black;
    }
    (a) on the left (b) in the middle (c) on the right

Answer key

  1. gap
  2. <h1 id="top">
  3. True
  4. adds space around boxes
  5. <h2 class="menu">
  6. blue
  7. red
  8. #intro
  9. 40
  10. padding
  11. the viewport meta tag
  12. red
  13. /*
  14. h1
  15. No
  16. True
  17. border
  18. #intro
  19. False
  20. text-align
  21. { }
  22. white
  23. adds space around boxes
  24. False
  25. equal gaps, none at ends
  26. 3
  27. True
  28. font-size
  29. an id selector
  30. an element selector
  31. 16
  32. #000000
  33. CSS
  34. 20
  35. orange
  36. red
  37. <p class="star">
  38. F
  39. a class selector
  40. on the right

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