← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 437 · 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.💪 Which justify-content value packs boxes at the start? (a) space-between (b) flex-end (c) center (d) flex-start
  2. 2.🖌️ What colour are the letters?
    p {
      color: blue;
      background-color: yellow;
      font-size: 16px;
      text-align: left;
    }
    (a) yellow (b) blue (c) green
  3. 3.✍️ Which sign ends each CSS declaration? (a) ; (b) . (c) : (d) ,
  4. 4.🖌️ How big is the text, in px?
    li {
      font-size: 28px;
      background-color: yellow;
      color: blue;
      text-align: right;
    }
  5. 5.✍️ How does a CSS comment start? (a) /* (b) <!-- (c) // (d) #
  6. 6.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 80px;
      padding: 30px;
      border: 3px solid black;
      margin: 5px;
    }
  7. 7.🖌️ What colour are the letters?
    p {
      font-size: 32px;
      background-color: orange;
      text-align: left;
      color: white;
    }
    (a) blue (b) white (c) orange
  8. 8.🖌️ What colour is behind the letters?
    h2 {
      text-align: left;
      color: black;
      background-color: red;
      font-size: 20px;
    }
    (a) black (b) red (c) white
  9. 9.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 2 (b) 4 (c) 6 (d) 3
  10. 10.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 22px;
      }
    }
  11. 11.🌈 Which colour is rgb(0, 255, 0)? (a) bright green (b) black (c) cyan (d) magenta
  12. 12.Which of these does JavaScript do? (a) sets colours and fonts (b) gives the page structure (c) lays out the page (d) changes the page live
  13. 13.Which of these does HTML do? (a) shows a pop-up message (b) gives the page structure (c) counts down a timer (d) changes the text size
  14. 14.What does background-color do? (a) colours behind the text (b) makes letters bigger (c) picks the font style (d) sets the letter colour
  15. 15.📱 Which tag helps phones show a page at the right size? (a) the viewport meta tag (b) the title tag (c) the br tag (d) the hr tag
  16. 16.✍️ In color: blue; which part is the property? (a) ; (b) color (c) blue (d) :
  17. 17.What does justify-content: flex-start do? (a) puts boxes in the middle (b) packs boxes at the end (c) packs boxes at the start (d) equal gaps, none at ends
  18. 18.📦 In the box model, which part is the gap to other boxes? (a) border (b) padding (c) content (d) margin
  19. 19.🎯 Which CSS selector matches this element?
    <h1 class="note" id="logo">Hello</h1>
    (a) h2 (b) #note (c) .note (d) #end
  20. 20.🧩 Which language adds space around boxes? (a) HTML (b) CSS (c) JavaScript
  21. 21.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 300px;
      justify-content: center;
    }
    Inside are 2 boxes, each 100px wide (no margins).
  22. 22.💪 Which justify-content value puts boxes in the middle? (a) space-between (b) center (c) flex-start (d) flex-end
  23. 23.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 230px;
      justify-content: flex-end;
    }
    Inside are 4 boxes, each 50px wide (no margins).
  24. 24.⚖️ What colour is the text of this element?
    <h1 class="note" id="intro">Hi</h1>
    CSS:
    .note { color: white; }
    #intro { color: red; }
    (a) green (b) orange (c) white (d) red
  25. 25.✍️ How many declarations (property: value pairs) are in this rule?
    .note {
      text-align: center;
    }
  26. 26.🎯 What kind of selector is h1? (a) a class selector (b) an id selector (c) an element selector
  27. 27.📱 What does a media query check? (a) the page title (b) the battery level (c) the time of day (d) the screen width
  28. 28.🧩 Which language shows a pop-up message? (a) HTML (b) CSS (c) JavaScript
  29. 29.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 130px;
      justify-content: flex-end;
    }
    Inside are 3 boxes, each 40px wide (no margins).
  30. 30.✍️ How many declarations (property: value pairs) are in this rule?
    li {
      font-weight: bold;
      padding: 8px;
    }
  31. 31.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 50px;
      padding: 5px;
      border: 3px solid black;
      margin: 15px;
    }
  32. 32.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 24px;
      }
    }
  33. 33.🖌️ Where does the text sit on its line?
    h1 {
      background-color: yellow;
      text-align: left;
      font-size: 40px;
      color: white;
    }
    (a) in the middle (b) on the right (c) on the left
  34. 34.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 32px;
      }
    }
  35. 35.Which of these does CSS do? (a) changes the page live (b) puts a picture on a page (c) changes the text size (d) gives the page structure
  36. 36.🎯 What kind of selector is .star? (a) an element selector (b) an id selector (c) a class selector
  37. 37.🎯 Can many elements share the same class? (a) No (b) Yes
  38. 38.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 180px;
      padding: 25px;
      border: 1px solid black;
      margin: 20px;
    }
  39. 39.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 170px;
      padding: 20px;
      border: 2px solid black;
      margin: 5px;
    }
  40. 40.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 110px;
      padding: 10px;
      border: 2px solid black;
      margin: 20px;
    }

Answer key

  1. flex-start
  2. blue
  3. ;
  4. 28
  5. /*
  6. 156
  7. white
  8. red
  9. 3
  10. 16
  11. bright green
  12. changes the page live
  13. gives the page structure
  14. colours behind the text
  15. the viewport meta tag
  16. color
  17. packs boxes at the start
  18. margin
  19. .note
  20. CSS
  21. 50
  22. center
  23. 30
  24. red
  25. 1
  26. an element selector
  27. the screen width
  28. JavaScript
  29. 10
  30. 2
  31. 96
  32. 24
  33. on the left
  34. 24
  35. changes the text size
  36. a class selector
  37. Yes
  38. 272
  39. 224
  40. 174

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