← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 33 · 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 color: blue; which part is the property? (a) ; (b) blue (c) color (d) :
  2. 2.🎯 Which CSS selector matches this element?
    <h1 class="star" id="logo">Hello</h1>
    (a) #star (b) #end (c) #logo (d) .logo
  3. 3.💪 Which justify-content value packs boxes at the start? (a) center (b) space-between (c) flex-start (d) flex-end
  4. 4.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 18px;
      }
    }
  5. 5.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 90px;
      padding: 10px;
      border: 5px solid black;
      margin: 5px;
    }
  6. 6.🧩 Which language counts down a timer? (a) HTML (b) CSS (c) JavaScript
  7. 7.⚖️ What colour is the text of this element?
    <h1 class="big" id="logo">Hi</h1>
    CSS:
    #logo { color: orange; }
    #logo { color: yellow; }
    (a) green (b) orange (c) yellow (d) blue
  8. 8.✍️ What value is given to color in this rule?
    #top {
      color: red;
      background-color: yellow;
    }
    (a) red (b) center (c) color (d) 20px
  9. 9.🎯 What kind of selector is li? (a) an id selector (b) an element selector (c) a class selector
  10. 10.Which of these does CSS do? (a) puts a picture on a page (b) makes headings and lists (c) sets colours and fonts (d) gives the page structure
  11. 11.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 150px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 40px wide (no margins).
  12. 12.🌈 Which colour is #00ffff? (a) yellow (b) cyan (c) blue (d) black
  13. 13.🎯 Which CSS selector matches this element?
    <h1 class="box" id="logo">Hello</h1>
    (a) #box (b) .box (c) .logo (d) .star
  14. 14.True or false: HTML changes the page live. (a) False (b) True
  15. 15.🎯 Which element does the selector .star style? (a) <h2 id="star"> (b) <li class="note"> (c) <h2 class="star"> (d) <h2 class="menu">
  16. 16.⚖️ What colour is the text of this element?
    <h2 class="note" id="main">Hi</h2>
    CSS:
    #main { color: black; }
    #main { color: purple; }
    (a) black (b) orange (c) purple (d) blue
  17. 17.🎯 How many elements on a page should have the same id? (a) 5 (b) 2 (c) any number (d) 1
  18. 18.True or false: HTML checks a quiz answer. (a) True (b) False
  19. 19.🌈 What is the biggest number one colour can have in rgb()? (a) 99 (b) 255 (c) 1000 (d) 100
  20. 20.✍️ Which property is set to 10px in this rule?
    body {
      font-size: 20px;
      font-weight: bold;
      margin: 10px;
    }
    (a) 10px (b) font-weight (c) margin (d) padding
  21. 21.💪 Which justify-content value packs boxes at the end? (a) flex-start (b) center (c) flex-end (d) space-between
  22. 22.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 210px;
      padding: 15px;
      border: 2px solid black;
      margin: 0px;
    }
  23. 23.✍️ Which sign goes between a property and its value? (a) = (b) - (c) ; (d) :
  24. 24.✍️ How many declarations (property: value pairs) are in this rule?
    p {
      background-color: yellow;
      margin: 10px;
      text-align: center;
      border: 2px solid;
    }
  25. 25.🔍 Which is the odd one out? (a) reacts to a button click (b) puts a picture on a page (c) checks a quiz answer (d) shows a pop-up message
  26. 26.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 200px;
      padding: 30px;
      border: 2px solid black;
      margin: 10px;
    }
  27. 27.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 380px;
      justify-content: center;
    }
    Inside are 4 boxes, each 60px wide (no margins).
  28. 28.What does justify-content: flex-start do? (a) equal gaps, none at ends (b) puts boxes in the middle (c) packs boxes at the end (d) packs boxes at the start
  29. 29.🧩 Which language shows a pop-up message? (a) CSS (b) HTML (c) JavaScript
  30. 30.⚖️ What colour is the text of this element?
    <p class="menu" id="hero">Hi</p>
    CSS:
    .menu { color: purple; }
    #hero { color: yellow; }
    p { color: red; }
    (a) purple (b) red (c) black (d) yellow
  31. 31.🔍 Which is the odd one out? (a) sets colours and fonts (b) makes a form box (c) makes a link (d) makes headings and lists
  32. 32.✍️ What is the selector in this CSS rule?
    .note {
      margin: 10px;
      border: 2px solid;
    }
    (a) margin (b) #top (c) .note (d) 2px solid
  33. 33.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 14px;
      }
    }
  34. 34.✍️ Which sign ends each CSS declaration? (a) ; (b) , (c) . (d) :
  35. 35.🖌️ How big is the text, in px?
    li {
      font-size: 32px;
      text-align: left;
      background-color: green;
      color: yellow;
    }
  36. 36.⚖️ What colour is the text of this element?
    <h2 class="big" id="top">Hi</h2>
    CSS:
    h2 { color: red; }
    h2 { color: black; }
    (a) green (b) red (c) blue (d) black
  37. 37.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the shorter one (b) the later one (c) neither (d) the first one
  38. 38.🖌️ What colour are the letters?
    p {
      font-size: 16px;
      text-align: center;
      background-color: white;
      color: blue;
    }
    (a) white (b) red (c) blue
  39. 39.True or false: the content is space outside the border. (a) True (b) False
  40. 40.Which of these does HTML do? (a) gives the page structure (b) rounds box corners (c) checks a quiz answer (d) lays out the page

Answer key

  1. color
  2. #logo
  3. flex-start
  4. 18
  5. 130
  6. JavaScript
  7. yellow
  8. red
  9. an element selector
  10. sets colours and fonts
  11. 70
  12. cyan
  13. .box
  14. False
  15. <h2 class="star">
  16. purple
  17. 1
  18. False
  19. 255
  20. margin
  21. flex-end
  22. 244
  23. :
  24. 4
  25. puts a picture on a page
  26. 284
  27. 70
  28. packs boxes at the start
  29. JavaScript
  30. yellow
  31. sets colours and fonts
  32. .note
  33. 14
  34. ;
  35. 32
  36. black
  37. the later one
  38. blue
  39. False
  40. gives the page structure

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