← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 895 · 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.True or false: the border is space outside the border. (a) True (b) False
  2. 2.🎯 Which CSS selector matches this element?
    <h2 class="big" id="main">Hello</h2>
    (a) .red (b) h2 (c) .main (d) #big
  3. 3.⚖️ What colour is the text of this element?
    <h2 class="big" id="logo">Hi</h2>
    CSS:
    h2 { color: green; }
    #logo { color: yellow; }
    (a) purple (b) green (c) yellow (d) red
  4. 4.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 3 (b) 4 (c) 6 (d) 2
  5. 5.🎯 What kind of selector is .big? (a) an element selector (b) a class selector (c) an id selector
  6. 6.💪 Which justify-content value equal gaps, none at ends? (a) center (b) space-between (c) flex-end (d) flex-start
  7. 7.🌈 Which hex code is yellow? (a) #ff00ff (b) #ffffff (c) #ffff00 (d) #00ffff
  8. 8.True or false: the content is space inside the border. (a) False (b) True
  9. 9.🔍 Which is the odd one out? (a) shows a pop-up message (b) makes a form box (c) changes the page live (d) counts down a timer
  10. 10.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 200px;
      padding: 30px;
      border: 2px solid black;
      margin: 10px;
    }
  11. 11.🎯 Which CSS selector matches this element?
    <span class="note" id="main">Hello</span>
    (a) .note (b) .big (c) p (d) .main
  12. 12.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 30px;
      }
    }
  13. 13.What does font-family do? (a) centres a heading (b) sets the letter colour (c) colours behind the text (d) picks the font style
  14. 14.✍️ In color: blue; which part is the property? (a) blue (b) ; (c) : (d) color
  15. 15.🎯 What kind of selector is #end? (a) a class selector (b) an element selector (c) an id selector
  16. 16.What does text-align do? (a) sets the letter colour (b) colours behind the text (c) makes the text bold (d) centres a heading
  17. 17.🎯 Which element does the selector .box style? (a) <li class="star"> (b) <li class="box"> (c) <li id="box"> (d) <div class="menu">
  18. 18.✍️ CSS declarations go inside which brackets? (a) ( ) (b) < > (c) [ ] (d) { }
  19. 19.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 270px;
      justify-content: flex-end;
    }
    Inside are 4 boxes, each 50px wide (no margins).
  20. 20.🖌️ Which CSS property makes the text bold? (a) font-weight (b) background-color (c) color (d) font-size
  21. 21.💪 Which flexbox property turns on flexbox? (a) gap (b) justify-content (c) display: flex (d) align-items
  22. 22.🎯 What kind of selector is .card? (a) an id selector (b) an element selector (c) a class selector
  23. 23.✍️ How does a CSS comment start? (a) /* (b) // (c) <!-- (d) #
  24. 24.🔍 Which is the odd one out? (a) checks a quiz answer (b) makes headings and lists (c) puts a picture on a page (d) makes a form box
  25. 25.📦 In the box model, which part is a solid or dotted edge? (a) padding (b) border (c) margin (d) content
  26. 26.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 180px;
      justify-content: flex-start;
    }
    Inside are 4 boxes, each 40px wide (no margins).
  27. 27.🎯 Which CSS selector matches this element?
    <div class="star" id="hero">Hello</div>
    (a) .hero (b) #top (c) #hero (d) #star
  28. 28.True or false: CSS adds space around boxes. (a) True (b) False
  29. 29.✍️ In color: blue; which part is the value? (a) ; (b) blue (c) : (d) color
  30. 30.⚖️ Which selector is the strongest? (a) a class selector (b) an element selector (c) an id selector
  31. 31.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 190px;
      padding: 30px;
      border: 1px solid black;
      margin: 15px;
    }
  32. 32.Which of these is margin? (a) the gap to other boxes (b) space inside the border (c) the gap round content (d) a solid or dotted edge
  33. 33.🎯 Which element does the selector #logo style? (a) <h1 class="logo"> (b) <h1 id="logo"> (c) <h1 id="end"> (d) <h2 class="menu">
  34. 34.⚖️ What colour is the text of this element?
    <h2 class="big" id="top">Hi</h2>
    CSS:
    #top { color: yellow; }
    .big { color: purple; }
    h2 { color: red; }
    (a) green (b) purple (c) red (d) yellow
  35. 35.✍️ What is the selector in this CSS rule?
    li {
      font-style: italic;
      color: red;
      padding: 8px;
    }
    (a) li (b) body (c) red (d) font-style
  36. 36.✍️ What is the selector in this CSS rule?
    #top {
      border: 2px solid;
      padding: 8px;
    }
    (a) 8px (b) border (c) li (d) #top
  37. 37.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 26px;
      }
    }
  38. 38.✍️ What is the selector in this CSS rule?
    #top {
      border: 2px solid;
      padding: 8px;
      text-align: center;
    }
    (a) li (b) #top (c) 8px (d) border
  39. 39.Which of these does HTML do? (a) lays out the page (b) gives the page structure (c) checks a quiz answer (d) reacts to a button click
  40. 40.⚖️ What colour is the text of this element?
    <h2 class="star" id="hero">Hi</h2>
    CSS:
    #hero { color: black; }
    #hero { color: orange; }
    (a) red (b) orange (c) green (d) black

Answer key

  1. False
  2. h2
  3. yellow
  4. 3
  5. a class selector
  6. space-between
  7. #ffff00
  8. False
  9. makes a form box
  10. 284
  11. .note
  12. 30
  13. picks the font style
  14. color
  15. an id selector
  16. centres a heading
  17. <li class="box">
  18. { }
  19. 70
  20. font-weight
  21. display: flex
  22. a class selector
  23. /*
  24. checks a quiz answer
  25. border
  26. 20
  27. #hero
  28. True
  29. blue
  30. an id selector
  31. 252
  32. the gap to other boxes
  33. <h1 id="logo">
  34. yellow
  35. li
  36. #top
  37. 26
  38. #top
  39. gives the page structure
  40. orange

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