← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 125 · 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.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 280px;
      padding: 20px;
      border: 1px solid black;
      margin: 0px;
    }
  2. 2.✍️ Which property is set to center in this rule?
    #top {
      font-size: 20px;
      text-align: center;
      font-weight: bold;
    }
    (a) background-color (b) margin (c) text-align (d) center
  3. 3.🎨 Which attribute adds CSS inside one tag? (a) alt (b) src (c) style (d) href
  4. 4.🌈 In #580000 the red part is the hex number 58. What is it as a normal number?
  5. 5.🌈 Which colour is #ffff00? (a) cyan (b) magenta (c) blue (d) yellow
  6. 6.What does justify-content: flex-end 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
  7. 7.⚖️ What colour is the text of this element?
    <h1 class="red" id="hero">Hi</h1>
    CSS:
    .red { color: black; }
    #hero { color: orange; }
    (a) green (b) orange (c) blue (d) black
  8. 8.🧩 Which language shows a pop-up message? (a) JavaScript (b) HTML (c) CSS
  9. 9.🎨 Which tag connects an outside CSS file? (a) <css> (b) <link> (c) <a> (d) <img>
  10. 10.🔍 Which is the odd one out? (a) changes the page live (b) checks a quiz answer (c) shows a pop-up message (d) gives the page structure
  11. 11.Which of these is the border? (a) the text or picture (b) a solid or dotted edge (c) space inside the border (d) space outside the border
  12. 12.📦 In the box model, which part is a solid or dotted edge? (a) content (b) margin (c) padding (d) border
  13. 13.🎯 Which element does the selector h1 style? (a) <h2> (b) <li class="note"> (c) <h1 class="note"> (d) <div id="end">
  14. 14.🌈 In #fd0000 the red part is the hex number fd. What is it as a normal number?
  15. 15.🖌️ What colour are the letters?
    h1 {
      font-size: 28px;
      background-color: yellow;
      color: blue;
      text-align: center;
    }
    (a) orange (b) blue (c) yellow
  16. 16.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 120px;
      padding: 20px;
      border: 2px solid black;
      margin: 0px;
    }
  17. 17.🎯 Which CSS selector matches this element?
    <li class="box" id="top">Hello</li>
    (a) .top (b) #intro (c) li (d) .star
  18. 18.✍️ What value is given to padding in this rule?
    #top {
      border: 2px solid;
      padding: 8px;
    }
    (a) 2px solid (b) 8px (c) bold (d) padding
  19. 19.⚖️ Which selector is the strongest? (a) an element selector (b) an id selector (c) a class selector
  20. 20.✍️ Which property is set to center in this rule?
    .box {
      font-size: 20px;
      text-align: center;
      width: 300px;
    }
    (a) text-align (b) background-color (c) center (d) margin
  21. 21.🧩 Which language makes a link? (a) CSS (b) JavaScript (c) HTML
  22. 22.⚖️ What colour is the text of this element?
    <p class="star" id="intro">Hi</p>
    CSS:
    #intro { color: red; }
    #intro { color: green; }
    (a) green (b) blue (c) red (d) yellow
  23. 23.✍️ What value is given to width in this rule?
    #top {
      border: 2px solid;
      font-weight: bold;
      width: 300px;
    }
    (a) red (b) italic (c) 300px (d) width
  24. 24.True or false: .big is an id selector. (a) False (b) True
  25. 25.✍️ What is the selector in this CSS rule?
    h1 {
      text-align: center;
      font-weight: bold;
      font-style: italic;
      width: 300px;
    }
    (a) text-align (b) p (c) bold (d) h1
  26. 26.📦 In the box model, which part is the text or picture? (a) margin (b) border (c) content (d) padding
  27. 27.⚖️ What colour is the text of this element?
    <p class="note" id="intro">Hi</p>
    CSS:
    #intro { color: purple; }
    #intro { color: black; }
    (a) black (b) green (c) purple (d) red
  28. 28.True or false: .menu is an element selector. (a) True (b) False
  29. 29.🎯 How many elements on a page should have the same id? (a) 5 (b) any number (c) 2 (d) 1
  30. 30.⚖️ What colour is the text of this element?
    <h1 class="star" id="main">Hi</h1>
    CSS:
    .star { color: green; }
    h1 { color: blue; }
    (a) green (b) purple (c) blue (d) red
  31. 31.⚖️ What colour is the text of this element?
    <p class="menu" id="end">Hi</p>
    CSS:
    #end { color: orange; }
    #end { color: red; }
    (a) white (b) black (c) orange (d) red
  32. 32.💪 Which justify-content value packs boxes at the start? (a) center (b) flex-end (c) flex-start (d) space-between
  33. 33.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 14px;
      }
    }
  34. 34.✍️ Which property is set to 8px in this rule?
    body {
      border: 2px solid;
      margin: 10px;
      padding: 8px;
    }
    (a) border (b) font-weight (c) 8px (d) padding
  35. 35.🌈 Which colour is #ff00ff? (a) bright green (b) cyan (c) blue (d) magenta
  36. 36.🔍 Which is the odd one out? (a) counts down a timer (b) checks a quiz answer (c) shows a pop-up message (d) makes a form box
  37. 37.✍️ In color: blue; which part is the property? (a) : (b) blue (c) ; (d) color
  38. 38.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 120px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 40px wide (no margins).
  39. 39.True or false: the border is the text or picture. (a) True (b) False
  40. 40.💪 Which flexbox property turns on flexbox? (a) align-items (b) display: flex (c) gap (d) justify-content

Answer key

  1. 322
  2. text-align
  3. style
  4. 88
  5. yellow
  6. packs boxes at the end
  7. orange
  8. JavaScript
  9. <link>
  10. gives the page structure
  11. a solid or dotted edge
  12. border
  13. <h1 class="note">
  14. 253
  15. blue
  16. 164
  17. li
  18. 8px
  19. an id selector
  20. text-align
  21. HTML
  22. green
  23. 300px
  24. False
  25. h1
  26. content
  27. black
  28. False
  29. 1
  30. green
  31. red
  32. flex-start
  33. 14
  34. padding
  35. magenta
  36. makes a form box
  37. color
  38. 40
  39. False
  40. display: flex

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