← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 478 · 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.📱 The screen is 1366px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 14px;
      }
    }
    (a) No (b) Yes
  2. 2.📱 max-width: 600px applies when the screen is ___. (a) turned off (b) 600px or narrower (c) exactly 1000px (d) 600px or wider
  3. 3.🎯 Which sign starts an id selector? (a) # (b) & (c) @ (d) .
  4. 4.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the later one (b) neither (c) the shorter one (d) the first one
  5. 5.✍️ Which sign goes between a property and its value? (a) - (b) = (c) ; (d) :
  6. 6.💪 Which flexbox property turns on flexbox? (a) gap (b) justify-content (c) align-items (d) display: flex
  7. 7.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 14px;
      }
    }
  8. 8.🖌️ What colour is behind the letters?
    h1 {
      text-align: right;
      font-size: 20px;
      color: purple;
      background-color: yellow;
    }
    (a) black (b) yellow (c) purple
  9. 9.Which of these is margin? (a) a solid or dotted edge (b) the gap to other boxes (c) the line round the box (d) space inside the border
  10. 10.⚖️ What colour is the text of this element?
    <h1 class="star" id="hero">Hi</h1>
    CSS:
    .star { color: white; }
    .star { color: green; }
    (a) white (b) red (c) green (d) black
  11. 11.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 110px;
      padding: 5px;
      border: 3px solid black;
      margin: 15px;
    }
  12. 12.✍️ In color: blue; which part is the value? (a) : (b) ; (c) color (d) blue
  13. 13.🧩 Which language makes a link? (a) CSS (b) JavaScript (c) HTML
  14. 14.🎯 What kind of selector is .big? (a) a class selector (b) an id selector (c) an element selector
  15. 15.🌈 Which hex code is red? (a) #ff0000 (b) #0000ff (c) #000000 (d) #ffff00
  16. 16.Which of these is padding? (a) the text or picture (b) the line round the box (c) the gap round content (d) space outside the border
  17. 17.⚖️ What colour is the text of this element?
    <p class="red" id="end">Hi</p>
    CSS:
    p { color: purple; }
    p { color: white; }
    (a) purple (b) white (c) black (d) orange
  18. 18.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 10px;
      }
    }
  19. 19.Which of these is the content? (a) the text or picture (b) the gap round content (c) the gap to other boxes (d) space outside the border
  20. 20.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 20px;
      }
    }
  21. 21.🎯 Which sign starts a class selector? (a) # (b) & (c) @ (d) .
  22. 22.⚖️ Which selector is the strongest? (a) an id selector (b) an element selector (c) a class selector
  23. 23.🌈 Which hex code is yellow? (a) #00ffff (b) #ff0000 (c) #ffff00 (d) #00ff00
  24. 24.⚖️ What colour is the text of this element?
    <h2 class="note" id="hero">Hi</h2>
    CSS:
    h2 { color: orange; }
    #hero { color: yellow; }
    (a) red (b) yellow (c) orange (d) blue
  25. 25.💪 Which justify-content value packs boxes at the start? (a) space-between (b) flex-start (c) center (d) flex-end
  26. 26.🔍 Which is the odd one out? (a) lays out the page (b) changes the text size (c) adds space around boxes (d) gives the page structure
  27. 27.✍️ Which property is set to yellow in this rule?
    h1 {
      background-color: yellow;
      font-style: italic;
    }
    (a) background-color (b) padding (c) yellow (d) margin
  28. 28.✍️ What value is given to margin in this rule?
    h1 {
      background-color: yellow;
      margin: 10px;
      padding: 8px;
    }
    (a) 8px (b) bold (c) 10px (d) margin
  29. 29.📦 In the box model, which part is the gap round content? (a) border (b) margin (c) content (d) padding
  30. 30.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
  31. 31.True or false: CSS shows a pop-up message. (a) False (b) True
  32. 32.🎯 What kind of selector is .star? (a) an id selector (b) a class selector (c) an element selector
  33. 33.🧩 Which language makes headings and lists? (a) CSS (b) HTML (c) JavaScript
  34. 34.✍️ Which property is set to 2px solid in this rule?
    p {
      border: 2px solid;
      margin: 10px;
    }
    (a) 2px solid (b) border (c) width (d) font-style
  35. 35.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 14px;
      }
    }
  36. 36.🎯 How many elements on a page should have the same id? (a) 2 (b) 1 (c) any number (d) 5
  37. 37.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 20px;
      }
    }
    (a) Yes (b) No
  38. 38.⚖️ What colour is the text of this element?
    <p class="note" id="end">Hi</p>
    CSS:
    p { color: black; }
    p { color: red; }
    (a) blue (b) black (c) red (d) orange
  39. 39.What does justify-content: flex-end do? (a) puts boxes in the middle (b) packs boxes at the end (c) equal gaps, none at ends (d) packs boxes at the start
  40. 40.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 210px;
      padding: 5px;
      border: 2px solid black;
      margin: 10px;
    }

Answer key

  1. No
  2. 600px or narrower
  3. #
  4. the later one
  5. :
  6. display: flex
  7. 12
  8. yellow
  9. the gap to other boxes
  10. green
  11. 156
  12. blue
  13. HTML
  14. a class selector
  15. #ff0000
  16. the gap round content
  17. white
  18. 12
  19. the text or picture
  20. 16
  21. .
  22. an id selector
  23. #ffff00
  24. yellow
  25. flex-start
  26. gives the page structure
  27. background-color
  28. 10px
  29. padding
  30. equal gaps, none at ends
  31. False
  32. a class selector
  33. HTML
  34. border
  35. 14
  36. 1
  37. No
  38. red
  39. packs boxes at the end
  40. 244

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