← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 514 · 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 540px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 18px;
      }
    }
    (a) No (b) Yes
  2. 2.✍️ How many declarations (property: value pairs) are in this rule?
    .box {
      background-color: yellow;
    }
  3. 3.⚖️ What colour is the text of this element?
    <h2 class="big" id="main">Hi</h2>
    CSS:
    #main { color: yellow; }
    .big { color: black; }
    h2 { color: blue; }
    (a) yellow (b) red (c) blue (d) black
  4. 4.🖌️ How big is the text, in px?
    h1 {
      font-size: 28px;
      background-color: green;
      color: blue;
      text-align: right;
    }
  5. 5.💪 Which justify-content value packs boxes at the end? (a) flex-end (b) flex-start (c) space-between (d) center
  6. 6.🖌️ Where does the text sit on its line?
    h1 {
      text-align: left;
      font-size: 40px;
      background-color: black;
      color: orange;
    }
    (a) on the right (b) on the left (c) in the middle
  7. 7.💪 Which flexbox property lines boxes up across? (a) align-items (b) display: flex (c) gap (d) justify-content
  8. 8.What does justify-content: space-between do? (a) packs boxes at the end (b) equal gaps, none at ends (c) puts boxes in the middle (d) packs boxes at the start
  9. 9.🎨 Which attribute adds CSS inside one tag? (a) alt (b) style (c) src (d) href
  10. 10.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 60px;
      padding: 10px;
      border: 1px solid black;
      margin: 20px;
    }
  11. 11.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 10px;
      }
    }
  12. 12.💪 Which flexbox property sets space between boxes? (a) flex-direction (b) gap (c) display: flex (d) align-items
  13. 13.⚖️ What colour is the text of this element?
    <h1 class="red" id="top">Hi</h1>
    CSS:
    #top { color: black; }
    #top { color: blue; }
    (a) white (b) black (c) green (d) blue
  14. 14.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 14px;
      }
    }
  15. 15.🎯 Which CSS selector matches this element?
    <li class="star" id="intro">Hello</li>
    (a) .menu (b) #star (c) div (d) li
  16. 16.What does justify-content: flex-start do? (a) packs boxes at the start (b) packs boxes at the end (c) puts boxes in the middle (d) equal gaps, none at ends
  17. 17.✍️ In color: blue; which part is the value? (a) : (b) color (c) ; (d) blue
  18. 18.🔍 Which is the odd one out? (a) counts down a timer (b) shows a pop-up message (c) reacts to a button click (d) changes the text size
  19. 19.Which of these does HTML do? (a) adds space around boxes (b) lays out the page (c) shows a pop-up message (d) makes a link
  20. 20.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 80px;
      padding: 20px;
      border: 5px solid black;
      margin: 0px;
    }
  21. 21.Which of these does HTML do? (a) reacts to a button click (b) changes the page live (c) makes a form box (d) lays out the page
  22. 22.🔍 Which is the odd one out? (a) reacts to a button click (b) puts a picture on a page (c) gives the page structure (d) makes a link
  23. 23.🎨 Which tag connects an outside CSS file? (a) <link> (b) <css> (c) <a> (d) <img>
  24. 24.🖌️ How big is the text, in px?
    p {
      color: orange;
      text-align: left;
      background-color: blue;
      font-size: 32px;
    }
  25. 25.True or false: CSS sets colours and fonts. (a) False (b) True
  26. 26.⚖️ What colour is the text of this element?
    <p class="box" id="logo">Hi</p>
    CSS:
    #logo { color: white; }
    p { color: orange; }
    (a) white (b) purple (c) orange (d) red
  27. 27.⚖️ Which selector is the weakest? (a) a class selector (b) an element selector (c) an id selector
  28. 28.💪 Which justify-content value puts boxes in the middle? (a) flex-end (b) center (c) flex-start (d) space-between
  29. 29.✍️ Which property is set to 10px in this rule?
    p {
      width: 300px;
      border: 2px solid;
      padding: 8px;
      margin: 10px;
    }
    (a) padding (b) 10px (c) font-weight (d) margin
  30. 30.✍️ How many declarations (property: value pairs) are in this rule?
    .box {
      color: red;
      padding: 8px;
    }
  31. 31.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 230px;
      padding: 15px;
      border: 1px solid black;
      margin: 15px;
    }
  32. 32.✍️ How many declarations (property: value pairs) are in this rule?
    li {
      width: 300px;
    }
  33. 33.🖌️ Which CSS property sets the letter colour? (a) background-color (b) text-align (c) font-size (d) color
  34. 34.📱 The screen is 414px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 22px;
      }
    }
    (a) Yes (b) No
  35. 35.✍️ What is the selector in this CSS rule?
    li {
      color: red;
      font-style: italic;
      font-size: 20px;
    }
    (a) li (b) color (c) italic (d) body
  36. 36.🖌️ Which CSS property picks the font style? (a) font-family (b) color (c) font-size (d) font-weight
  37. 37.🎨 One CSS file can style how many pages? (a) only one image (b) only one word (c) no pages (d) many pages
  38. 38.💪 Which justify-content value equal gaps, none at ends? (a) flex-end (b) center (c) space-between (d) flex-start
  39. 39.⚖️ What colour is the text of this element?
    <p class="big" id="top">Hi</p>
    CSS:
    .big { color: green; }
    .big { color: white; }
    (a) purple (b) white (c) green (d) orange
  40. 40.🌈 Which colour is #ff00ff? (a) magenta (b) blue (c) white (d) bright green

Answer key

  1. Yes
  2. 1
  3. yellow
  4. 28
  5. flex-end
  6. on the left
  7. align-items
  8. equal gaps, none at ends
  9. style
  10. 122
  11. 10
  12. gap
  13. blue
  14. 14
  15. li
  16. packs boxes at the start
  17. blue
  18. changes the text size
  19. makes a link
  20. 130
  21. makes a form box
  22. reacts to a button click
  23. <link>
  24. 32
  25. True
  26. white
  27. an element selector
  28. center
  29. margin
  30. 2
  31. 262
  32. 1
  33. color
  34. No
  35. li
  36. font-family
  37. many pages
  38. space-between
  39. white
  40. magenta

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