← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 339 · 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.🎯 What kind of selector is #main? (a) an id selector (b) a class selector (c) an element selector
  2. 2.True or false: .big is an element selector. (a) False (b) True
  3. 3.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 10px;
      }
    }
  4. 4.🌈 Which hex code is blue? (a) #ff0000 (b) #ffffff (c) #ff00ff (d) #0000ff
  5. 5.💪 Which flexbox property picks row or column? (a) display: flex (b) flex-direction (c) gap (d) align-items
  6. 6.✍️ What value is given to padding in this rule?
    .note {
      font-size: 20px;
      width: 300px;
      border: 2px solid;
      padding: 8px;
    }
    (a) 8px (b) padding (c) bold (d) 2px solid
  7. 7.✍️ How many declarations (property: value pairs) are in this rule?
    h1 {
      width: 300px;
    }
  8. 8.What does font-size do? (a) makes the text bold (b) makes letters bigger (c) sets the letter colour (d) picks the font style
  9. 9.📦 In the box model, which part is a solid or dotted edge? (a) padding (b) content (c) border (d) margin
  10. 10.🎯 What kind of selector is .big? (a) an id selector (b) a class selector (c) an element selector
  11. 11.True or false: the border is the line round the box. (a) False (b) True
  12. 12.✍️ Which property is set to 10px in this rule?
    body {
      color: red;
      margin: 10px;
      width: 300px;
      background-color: yellow;
    }
    (a) padding (b) 10px (c) font-weight (d) margin
  13. 13.True or false: padding is space inside the border. (a) False (b) True
  14. 14.🧩 Which language puts a picture on a page? (a) HTML (b) CSS (c) JavaScript
  15. 15.📱 min-width: 800px applies when the screen is ___. (a) 800px or narrower (b) turned off (c) exactly 100px (d) 800px or wider
  16. 16.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 170px;
      justify-content: space-between;
    }
    Inside are 2 boxes, each 60px wide (no margins).
  17. 17.🌈 Which hex code is black? (a) #ffffff (b) #ffff00 (c) #000000 (d) #00ff00
  18. 18.Which of these does HTML do? (a) lays out the page (b) gives the page structure (c) sets colours and fonts (d) reacts to a button click
  19. 19.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 190px;
      padding: 20px;
      border: 3px solid black;
      margin: 10px;
    }
  20. 20.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 110px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 50px wide (no margins).
  21. 21.💪 Which justify-content value packs boxes at the start? (a) flex-end (b) space-between (c) center (d) flex-start
  22. 22.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 150px;
      padding: 30px;
      border: 5px solid black;
      margin: 10px;
    }
  23. 23.🌈 Which colour is #ffff00? (a) white (b) yellow (c) black (d) bright green
  24. 24.🌈 In #00c500 the green part is the hex number c5. What is it as a normal number?
  25. 25.🖌️ What colour is behind the letters?
    h1 {
      text-align: left;
      color: orange;
      background-color: yellow;
      font-size: 28px;
    }
    (a) purple (b) orange (c) yellow
  26. 26.🎨 A CSS file usually ends with which extension? (a) .css (b) .js (c) .png (d) .html
  27. 27.✍️ How many declarations (property: value pairs) are in this rule?
    h1 {
      margin: 10px;
      width: 300px;
      font-style: italic;
    }
  28. 28.🎨 Which tag holds CSS inside the head? (a) <body> (b) <style> (c) <css> (d) <script>
  29. 29.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 16px;
      }
    }
  30. 30.📦 In the box model, which part is space outside the border? (a) margin (b) border (c) padding (d) content
  31. 31.🌈 Which colour is rgb(255, 0, 255)? (a) red (b) bright green (c) yellow (d) magenta
  32. 32.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 90px;
      padding: 5px;
      border: 2px solid black;
      margin: 5px;
    }
  33. 33.🎯 How many elements on a page should have the same id? (a) 5 (b) 1 (c) 2 (d) any number
  34. 34.🎯 Which CSS selector matches this element?
    <span class="star" id="hero">Hello</span>
    (a) #star (b) #hero (c) #top (d) .hero
  35. 35.⚖️ What colour is the text of this element?
    <p class="menu" id="hero">Hi</p>
    CSS:
    p { color: orange; }
    #hero { color: yellow; }
    (a) orange (b) blue (c) purple (d) yellow
  36. 36.🔍 Which is the odd one out? (a) adds space around boxes (b) checks a quiz answer (c) changes the text size (d) sets colours and fonts
  37. 37.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 160px;
      padding: 25px;
      border: 3px solid black;
      margin: 0px;
    }
  38. 38.🖌️ Which CSS property makes letters bigger? (a) font-weight (b) font-family (c) font-size (d) background-color
  39. 39.True or false: the border is a solid or dotted edge. (a) False (b) True
  40. 40.True or false: .big is a class selector. (a) False (b) True

Answer key

  1. an id selector
  2. False
  3. 10
  4. #0000ff
  5. flex-direction
  6. 8px
  7. 1
  8. makes letters bigger
  9. border
  10. a class selector
  11. True
  12. margin
  13. True
  14. HTML
  15. 800px or wider
  16. 50
  17. #000000
  18. gives the page structure
  19. 256
  20. 10
  21. flex-start
  22. 240
  23. yellow
  24. 197
  25. yellow
  26. .css
  27. 3
  28. <style>
  29. 16
  30. margin
  31. magenta
  32. 114
  33. 1
  34. #hero
  35. yellow
  36. checks a quiz answer
  37. 216
  38. font-size
  39. True
  40. True

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