← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 82 · 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.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 22px;
      }
    }
  2. 2.🧩 Which language gives the page structure? (a) CSS (b) JavaScript (c) HTML
  3. 3.Which of these does JavaScript do? (a) lays out the page (b) counts down a timer (c) changes the text size (d) rounds box corners
  4. 4.🎯 Which CSS selector matches this element?
    <h2 class="note" id="intro">Hello</h2>
    (a) #main (b) .big (c) .intro (d) .note
  5. 5.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 220px;
      justify-content: center;
    }
    Inside are 4 boxes, each 50px wide (no margins).
  6. 6.⚖️ What colour is the text of this element?
    <h2 class="big" id="main">Hi</h2>
    CSS:
    #main { color: green; }
    #main { color: orange; }
    (a) purple (b) green (c) yellow (d) orange
  7. 7.Which of these does CSS do? (a) gives the page structure (b) lays out the page (c) counts down a timer (d) changes the page live
  8. 8.✍️ In color: blue; which part is the property? (a) blue (b) : (c) ; (d) color
  9. 9.What does justify-content: center do? (a) equal gaps, none at ends (b) packs boxes at the end (c) packs boxes at the start (d) puts boxes in the middle
  10. 10.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 120px;
      padding: 15px;
      border: 4px solid black;
      margin: 20px;
    }
  11. 11.🎯 Which CSS selector matches this element?
    <h1 class="big" id="hero">Hello</h1>
    (a) .red (b) h2 (c) #hero (d) .hero
  12. 12.Which of these does HTML do? (a) rounds box corners (b) adds space around boxes (c) lays out the page (d) puts a picture on a page
  13. 13.✍️ Which property is set to 300px in this rule?
    body {
      width: 300px;
      color: red;
    }
    (a) 300px (b) font-style (c) width (d) color
  14. 14.🖌️ Which CSS property centres a heading? (a) font-weight (b) color (c) background-color (d) text-align
  15. 15.💪 Which flexbox property turns on flexbox? (a) justify-content (b) align-items (c) flex-direction (d) display: flex
  16. 16.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 40px;
      padding: 5px;
      border: 1px solid black;
      margin: 15px;
    }
  17. 17.💪 Which justify-content value packs boxes at the start? (a) flex-end (b) center (c) flex-start (d) space-between
  18. 18.✍️ How does a CSS comment start? (a) // (b) <!-- (c) /* (d) #
  19. 19.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 220px;
      padding: 5px;
      border: 2px solid black;
      margin: 5px;
    }
  20. 20.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 26px;
      }
    }
  21. 21.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 180px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 60px wide (no margins).
  22. 22.🎯 Which CSS selector matches this element?
    <h1 class="box" id="logo">Hello</h1>
    (a) .logo (b) .box (c) h2 (d) #box
  23. 23.Which of these is padding? (a) the text or picture (b) the gap to other boxes (c) a solid or dotted edge (d) the gap round content
  24. 24.✍️ Which property is set to italic in this rule?
    h1 {
      font-style: italic;
      padding: 8px;
      color: red;
      margin: 10px;
    }
    (a) italic (b) color (c) font-style (d) font-size
  25. 25.✍️ Which property is set to center in this rule?
    p {
      font-style: italic;
      text-align: center;
    }
    (a) margin (b) center (c) text-align (d) background-color
  26. 26.🖌️ Which CSS property picks the font style? (a) font-size (b) font-weight (c) text-align (d) font-family
  27. 27.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 40px;
      padding: 25px;
      border: 1px solid black;
      margin: 15px;
    }
  28. 28.✍️ Which sign goes between a property and its value? (a) = (b) : (c) - (d) ;
  29. 29.True or false: #logo is an id selector. (a) True (b) False
  30. 30.🎯 Which CSS selector matches this element?
    <li class="box" id="intro">Hello</li>
    (a) .intro (b) .box (c) .star (d) #box
  31. 31.🎯 Which CSS selector matches this element?
    <span class="red" id="intro">Hello</span>
    (a) .box (b) #main (c) .red (d) #red
  32. 32.🎯 Which element does the selector span style? (a) <span class="box"> (b) <p> (c) <h1 class="box"> (d) <h2 id="main">
  33. 33.Which of these does HTML do? (a) changes the text size (b) lays out the page (c) shows a pop-up message (d) gives the page structure
  34. 34.✍️ Which property is set to 300px in this rule?
    li {
      text-align: center;
      padding: 8px;
      font-size: 20px;
      width: 300px;
    }
    (a) 300px (b) color (c) font-style (d) width
  35. 35.True or false: margin is the gap round content. (a) True (b) False
  36. 36.🔍 Which is the odd one out? (a) makes a link (b) rounds box corners (c) adds space around boxes (d) sets colours and fonts
  37. 37.✍️ What value is given to text-align in this rule?
    h1 {
      padding: 8px;
      margin: 10px;
      border: 2px solid;
      text-align: center;
    }
    (a) text-align (b) yellow (c) 10px (d) center
  38. 38.🔍 Which is the odd one out? (a) rounds box corners (b) changes the text size (c) lays out the page (d) counts down a timer
  39. 39.🧩 Which language checks a quiz answer? (a) JavaScript (b) HTML (c) CSS
  40. 40.⚖️ Which selector is the weakest? (a) a class selector (b) an id selector (c) an element selector

Answer key

  1. 22
  2. HTML
  3. counts down a timer
  4. .note
  5. 10
  6. orange
  7. lays out the page
  8. color
  9. puts boxes in the middle
  10. 198
  11. #hero
  12. puts a picture on a page
  13. width
  14. text-align
  15. display: flex
  16. 82
  17. flex-start
  18. /*
  19. 244
  20. 26
  21. 60
  22. .box
  23. the gap round content
  24. font-style
  25. text-align
  26. font-family
  27. 122
  28. :
  29. True
  30. .box
  31. .red
  32. <span class="box">
  33. gives the page structure
  34. width
  35. False
  36. makes a link
  37. center
  38. counts down a timer
  39. JavaScript
  40. an element selector

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