← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 854 · 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.📱 Responsive design means a page ___. (a) is only for laptops (b) never changes (c) has no pictures (d) fits every screen
  2. 2.🖌️ Which CSS property sets the letter colour? (a) font-size (b) color (c) font-weight (d) font-family
  3. 3.✍️ What is the selector in this CSS rule?
    .note {
      font-weight: bold;
      color: red;
    }
    (a) .note (b) font-weight (c) red (d) #top
  4. 4.🎯 Which CSS selector matches this element?
    <li class="note" id="intro">Hello</li>
    (a) .intro (b) .big (c) .note (d) #note
  5. 5.🌈 Which colour of light is strongest in rgb(222, 108, 58)? (a) red (b) green (c) blue
  6. 6.What does justify-content: center do? (a) equal gaps, none at ends (b) packs boxes at the end (c) packs boxes at the start (d) puts boxes in the middle
  7. 7.⚖️ What colour is the text of this element?
    <p class="big" id="main">Hi</p>
    CSS:
    #main { color: red; }
    p { color: green; }
    (a) yellow (b) green (c) red (d) orange
  8. 8.True or false: the content is a solid or dotted edge. (a) False (b) True
  9. 9.Which of these does HTML do? (a) puts a picture on a page (b) reacts to a button click (c) counts down a timer (d) changes the page live
  10. 10.⚖️ What colour is the text of this element?
    <h1 class="menu" id="logo">Hi</h1>
    CSS:
    h1 { color: yellow; }
    h1 { color: green; }
    (a) yellow (b) green (c) black (d) red
  11. 11.⚖️ What colour is the text of this element?
    <p class="big" id="hero">Hi</p>
    CSS:
    p { color: yellow; }
    p { color: purple; }
    (a) yellow (b) white (c) purple (d) black
  12. 12.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 80px;
      padding: 30px;
      border: 1px solid black;
      margin: 0px;
    }
  13. 13.💪 Which justify-content value equal gaps, none at ends? (a) flex-end (b) center (c) space-between (d) flex-start
  14. 14.🖌️ Which CSS property picks the font style? (a) font-size (b) font-family (c) text-align (d) background-color
  15. 15.✍️ What is the selector in this CSS rule?
    #top {
      margin: 10px;
      color: red;
    }
    (a) li (b) red (c) #top (d) margin
  16. 16.✍️ What value is given to padding in this rule?
    p {
      padding: 8px;
      margin: 10px;
      border: 2px solid;
    }
    (a) 8px (b) padding (c) bold (d) 2px solid
  17. 17.📱 max-width: 600px applies when the screen is ___. (a) turned off (b) 600px or wider (c) 600px or narrower (d) exactly 1000px
  18. 18.🎯 Which sign starts an id selector? (a) . (b) @ (c) # (d) &
  19. 19.Which of these is the content? (a) the text or picture (b) space outside the border (c) the gap round content (d) the gap to other boxes
  20. 20.⚖️ What colour is the text of this element?
    <p class="red" id="intro">Hi</p>
    CSS:
    #intro { color: green; }
    p { color: red; }
    (a) blue (b) red (c) white (d) green
  21. 21.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 18px;
      }
    }
  22. 22.💪 Which flexbox property picks row or column? (a) align-items (b) gap (c) justify-content (d) flex-direction
  23. 23.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 8px;
      }
    }
  24. 24.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 110px;
      padding: 10px;
      border: 4px solid black;
      margin: 10px;
    }
  25. 25.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 60px;
      padding: 20px;
      border: 2px solid black;
      margin: 0px;
    }
  26. 26.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 220px;
      padding: 10px;
      border: 1px solid black;
      margin: 10px;
    }
  27. 27.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 160px;
      justify-content: center;
    }
    Inside are 3 boxes, each 40px wide (no margins).
  28. 28.🧩 Which language changes the text size? (a) HTML (b) JavaScript (c) CSS
  29. 29.What does justify-content: space-between do? (a) packs boxes at the end (b) puts boxes in the middle (c) equal gaps, none at ends (d) packs boxes at the start
  30. 30.📱 min-width: 800px applies when the screen is ___. (a) turned off (b) 800px or wider (c) exactly 100px (d) 800px or narrower
  31. 31.✍️ What value is given to font-weight in this rule?
    p {
      text-align: center;
      font-weight: bold;
    }
    (a) 300px (b) bold (c) font-weight (d) 2px solid
  32. 32.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 20px;
      }
    }
  33. 33.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 220px;
      justify-content: center;
    }
    Inside are 2 boxes, each 40px wide (no margins).
  34. 34.What does justify-content: flex-start do? (a) packs boxes at the end (b) packs boxes at the start (c) puts boxes in the middle (d) equal gaps, none at ends
  35. 35.🎨 Which tag connects an outside CSS file? (a) <img> (b) <css> (c) <link> (d) <a>
  36. 36.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 300px;
      padding: 20px;
      border: 3px solid black;
      margin: 5px;
    }
  37. 37.🎯 Which CSS selector matches this element?
    <p class="box" id="end">Hello</p>
    (a) p (b) #box (c) #hero (d) .end
  38. 38.📦 In the box model, which part is the gap round content? (a) padding (b) content (c) border (d) margin
  39. 39.✍️ Which sign ends each CSS declaration? (a) : (b) , (c) . (d) ;
  40. 40.✍️ How many declarations (property: value pairs) are in this rule?
    h1 {
      margin: 10px;
    }

Answer key

  1. fits every screen
  2. color
  3. .note
  4. .note
  5. red
  6. puts boxes in the middle
  7. red
  8. False
  9. puts a picture on a page
  10. green
  11. purple
  12. 142
  13. space-between
  14. font-family
  15. #top
  16. 8px
  17. 600px or narrower
  18. #
  19. the text or picture
  20. green
  21. 18
  22. flex-direction
  23. 12
  24. 138
  25. 104
  26. 242
  27. 20
  28. CSS
  29. equal gaps, none at ends
  30. 800px or wider
  31. bold
  32. 24
  33. 70
  34. packs boxes at the start
  35. <link>
  36. 356
  37. p
  38. padding
  39. ;
  40. 1

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