← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 541 · 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 does justify-content: flex-start do? (a) packs boxes at the end (b) packs boxes at the start (c) equal gaps, none at ends (d) puts boxes in the middle
  2. 2.✍️ In color: blue; which part is the value? (a) : (b) ; (c) color (d) blue
  3. 3.True or false: JavaScript makes headings and lists. (a) True (b) False
  4. 4.✍️ Which property is set to center in this rule?
    h2 {
      width: 300px;
      text-align: center;
    }
    (a) background-color (b) text-align (c) center (d) margin
  5. 5.✍️ How many declarations (property: value pairs) are in this rule?
    .note {
      margin: 10px;
      text-align: center;
    }
  6. 6.📱 The screen is 820px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 18px;
      }
    }
    (a) No (b) Yes
  7. 7.🔍 Which is the odd one out? (a) changes the text size (b) lays out the page (c) changes the page live (d) rounds box corners
  8. 8.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 20px;
      }
    }
  9. 9.🎯 Which sign starts an id selector? (a) & (b) @ (c) # (d) .
  10. 10.✍️ How many declarations (property: value pairs) are in this rule?
    li {
      font-style: italic;
      font-size: 20px;
      color: red;
      width: 300px;
    }
  11. 11.📱 Responsive design means a page ___. (a) is only for laptops (b) fits every screen (c) never changes (d) has no pictures
  12. 12.⚖️ What colour is the text of this element?
    <p class="note" id="top">Hi</p>
    CSS:
    p { color: blue; }
    p { color: yellow; }
    (a) green (b) white (c) yellow (d) blue
  13. 13.What does font-family do? (a) colours behind the text (b) makes letters bigger (c) centres a heading (d) picks the font style
  14. 14.🎯 Which CSS selector matches this element?
    <p class="note" id="logo">Hello</p>
    (a) .logo (b) h1 (c) .big (d) #logo
  15. 15.🖌️ How big is the text, in px?
    h1 {
      color: black;
      text-align: left;
      background-color: green;
      font-size: 20px;
    }
  16. 16.True or false: .menu is an element selector. (a) True (b) False
  17. 17.✍️ What is the selector in this CSS rule?
    li {
      border: 2px solid;
      font-weight: bold;
    }
    (a) bold (b) body (c) li (d) border
  18. 18.🎯 How many elements on a page should have the same id? (a) 2 (b) 1 (c) any number (d) 5
  19. 19.Which of these is the border? (a) the text or picture (b) space outside the border (c) a solid or dotted edge (d) the gap round content
  20. 20.🖌️ Which CSS property picks the font style? (a) text-align (b) font-weight (c) background-color (d) font-family
  21. 21.🧩 Which language makes a link? (a) JavaScript (b) HTML (c) CSS
  22. 22.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 150px;
      padding: 5px;
      border: 3px solid black;
      margin: 10px;
    }
  23. 23.🖌️ Which CSS property centres a heading? (a) font-size (b) font-family (c) text-align (d) color
  24. 24.📱 The screen is 540px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 28px;
      }
    }
    (a) No (b) Yes
  25. 25.🔍 Which is the odd one out? (a) changes the page live (b) gives the page structure (c) counts down a timer (d) shows a pop-up message
  26. 26.Which of these is padding? (a) the gap to other boxes (b) a solid or dotted edge (c) the text or picture (d) space inside the border
  27. 27.⚖️ Two rules with the same selector set a colour. Which one wins? (a) neither (b) the later one (c) the shorter one (d) the first one
  28. 28.🎯 Which CSS selector matches this element?
    <span class="note" id="main">Hello</span>
    (a) #main (b) p (c) .big (d) #note
  29. 29.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 130px;
      padding: 10px;
      border: 4px solid black;
      margin: 20px;
    }
  30. 30.🎯 Which element does the selector #top style? (a) <h2 class="top"> (b) <h2 id="intro"> (c) <h2 id="top"> (d) <li class="box">
  31. 31.🖌️ What colour are the letters?
    h2 {
      color: purple;
      font-size: 28px;
      text-align: left;
      background-color: black;
    }
    (a) black (b) red (c) purple
  32. 32.✍️ Which property is set to 10px in this rule?
    p {
      margin: 10px;
      font-size: 20px;
      font-style: italic;
    }
    (a) margin (b) padding (c) font-weight (d) 10px
  33. 33.⚖️ What colour is the text of this element?
    <h1 class="menu" id="hero">Hi</h1>
    CSS:
    #hero { color: orange; }
    h1 { color: white; }
    (a) white (b) red (c) orange (d) yellow
  34. 34.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 22px;
      }
    }
  35. 35.True or false: h1 is an element selector. (a) True (b) False
  36. 36.What does justify-content: center do? (a) puts boxes in the middle (b) packs boxes at the start (c) equal gaps, none at ends (d) packs boxes at the end
  37. 37.📱 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;
      }
    }
  38. 38.True or false: CSS rounds box corners. (a) False (b) True
  39. 39.✍️ CSS declarations go inside which brackets? (a) [ ] (b) ( ) (c) { } (d) < >
  40. 40.🎯 Which element does the selector #top style? (a) <div id="intro"> (b) <div class="top"> (c) <div id="top"> (d) <span class="big">

Answer key

  1. packs boxes at the start
  2. blue
  3. False
  4. text-align
  5. 2
  6. No
  7. changes the page live
  8. 12
  9. #
  10. 4
  11. fits every screen
  12. yellow
  13. picks the font style
  14. #logo
  15. 20
  16. False
  17. li
  18. 1
  19. a solid or dotted edge
  20. font-family
  21. HTML
  22. 186
  23. text-align
  24. Yes
  25. gives the page structure
  26. space inside the border
  27. the later one
  28. #main
  29. 198
  30. <h2 id="top">
  31. purple
  32. margin
  33. orange
  34. 16
  35. True
  36. puts boxes in the middle
  37. 16
  38. True
  39. { }
  40. <div id="top">

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