← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 180 · 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 empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 430px;
      justify-content: flex-start;
    }
    Inside are 4 boxes, each 100px wide (no margins).
  2. 2.📱 Which tag helps phones show a page at the right size? (a) the viewport meta tag (b) the title tag (c) the hr tag (d) the br tag
  3. 3.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 440px;
      justify-content: flex-start;
    }
    Inside are 4 boxes, each 100px wide (no margins).
  4. 4.✍️ How many declarations (property: value pairs) are in this rule?
    h1 {
      font-weight: bold;
      background-color: yellow;
    }
  5. 5.🎨 A CSS file usually ends with which extension? (a) .css (b) .js (c) .html (d) .png
  6. 6.🎯 Which CSS selector matches this element?
    <p class="box" id="hero">Hello</p>
    (a) #box (b) .hero (c) .star (d) p
  7. 7.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 190px;
      padding: 5px;
      border: 3px solid black;
      margin: 0px;
    }
  8. 8.What does justify-content: space-between 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
  9. 9.What does justify-content: flex-start do? (a) puts boxes in the middle (b) equal gaps, none at ends (c) packs boxes at the end (d) packs boxes at the start
  10. 10.✍️ Which sign ends each CSS declaration? (a) , (b) . (c) ; (d) :
  11. 11.💪 Which flexbox property turns on flexbox? (a) gap (b) justify-content (c) align-items (d) display: flex
  12. 12.🌈 In #0000b4 the blue part is the hex number b4. What is it as a normal number?
  13. 13.📱 What does a media query check? (a) the battery level (b) the page title (c) the screen width (d) the time of day
  14. 14.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 22px;
      }
    }
  15. 15.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 100px;
      padding: 20px;
      border: 3px solid black;
      margin: 0px;
    }
  16. 16.True or false: padding is the gap round content. (a) False (b) True
  17. 17.⚖️ What colour is the text of this element?
    <h1 class="big" id="top">Hi</h1>
    CSS:
    .big { color: yellow; }
    #top { color: red; }
    (a) purple (b) yellow (c) blue (d) red
  18. 18.⚖️ Two rules with the same selector set a colour. Which one wins? (a) neither (b) the shorter one (c) the later one (d) the first one
  19. 19.🔍 Which is the odd one out? (a) adds space around boxes (b) counts down a timer (c) shows a pop-up message (d) checks a quiz answer
  20. 20.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 300px;
      padding: 5px;
      border: 2px solid black;
      margin: 15px;
    }
  21. 21.True or false: body is a class selector. (a) True (b) False
  22. 22.🎯 Which CSS selector matches this element?
    <h2 class="big" id="end">Hello</h2>
    (a) .red (b) li (c) #big (d) .big
  23. 23.🌈 Which colour is #00ff00? (a) black (b) bright green (c) white (d) magenta
  24. 24.📱 min-width: 800px applies when the screen is ___. (a) turned off (b) 800px or narrower (c) exactly 100px (d) 800px or wider
  25. 25.✍️ Which property is set to 2px solid in this rule?
    p {
      text-align: center;
      margin: 10px;
      border: 2px solid;
      font-style: italic;
    }
    (a) 2px solid (b) width (c) border (d) font-style
  26. 26.🎯 How many elements on a page should have the same id? (a) 1 (b) any number (c) 2 (d) 5
  27. 27.⚖️ What colour is the text of this element?
    <h2 class="star" id="hero">Hi</h2>
    CSS:
    h2 { color: purple; }
    .star { color: green; }
    (a) yellow (b) green (c) black (d) purple
  28. 28.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 160px;
      justify-content: space-between;
    }
    Inside are 3 boxes, each 40px wide (no margins).
  29. 29.🌈 In #d80000 the red part is the hex number d8. What is it as a normal number?
  30. 30.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 2 (b) 3 (c) 6 (d) 4
  31. 31.⚖️ What colour is the text of this element?
    <h2 class="box" id="hero">Hi</h2>
    CSS:
    #hero { color: green; }
    #hero { color: black; }
    (a) green (b) white (c) purple (d) black
  32. 32.💪 Which flexbox property sets space between boxes? (a) flex-direction (b) gap (c) justify-content (d) display: flex
  33. 33.🌈 Which colour is #ffff00? (a) yellow (b) red (c) magenta (d) bright green
  34. 34.✍️ How does a CSS comment start? (a) /* (b) // (c) <!-- (d) #
  35. 35.💪 Which flexbox property picks row or column? (a) flex-direction (b) gap (c) display: flex (d) align-items
  36. 36.🧩 Which language rounds box corners? (a) JavaScript (b) CSS (c) HTML
  37. 37.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 320px;
      justify-content: flex-start;
    }
    Inside are 3 boxes, each 100px wide (no margins).
  38. 38.🔍 Which is the odd one out? (a) lays out the page (b) changes the text size (c) sets colours and fonts (d) checks a quiz answer
  39. 39.🖌️ What colour are the letters?
    li {
      background-color: orange;
      color: blue;
      font-size: 36px;
      text-align: center;
    }
    (a) orange (b) white (c) blue
  40. 40.✍️ What value is given to background-color in this rule?
    li {
      padding: 8px;
      background-color: yellow;
      text-align: center;
    }
    (a) yellow (b) background-color (c) 10px (d) 8px

Answer key

  1. 30
  2. the viewport meta tag
  3. 40
  4. 2
  5. .css
  6. p
  7. 206
  8. equal gaps, none at ends
  9. packs boxes at the start
  10. ;
  11. display: flex
  12. 180
  13. the screen width
  14. 20
  15. 146
  16. True
  17. red
  18. the later one
  19. adds space around boxes
  20. 344
  21. False
  22. .big
  23. bright green
  24. 800px or wider
  25. border
  26. 1
  27. green
  28. 20
  29. 216
  30. 3
  31. black
  32. gap
  33. yellow
  34. /*
  35. flex-direction
  36. CSS
  37. 20
  38. checks a quiz answer
  39. blue
  40. yellow

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