← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 823 · 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.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 240px;
      justify-content: flex-end;
    }
    Inside are 2 boxes, each 100px wide (no margins).
  2. 2.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 18px;
      }
    }
  3. 3.✍️ Which property is set to yellow in this rule?
    body {
      width: 300px;
      border: 2px solid;
      background-color: yellow;
      text-align: center;
    }
    (a) padding (b) yellow (c) background-color (d) margin
  4. 4.✍️ Which property is set to yellow in this rule?
    p {
      margin: 10px;
      background-color: yellow;
    }
    (a) background-color (b) yellow (c) margin (d) padding
  5. 5.🎯 Which element does the selector #logo style? (a) <span class="logo"> (b) <span id="logo"> (c) <span id="end"> (d) <p class="star">
  6. 6.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 28px;
      }
    }
  7. 7.💪 Which justify-content value puts boxes in the middle? (a) center (b) space-between (c) flex-end (d) flex-start
  8. 8.🖌️ Which CSS property sets the letter colour? (a) font-size (b) font-family (c) color (d) font-weight
  9. 9.Which of these does CSS do? (a) makes a link (b) makes headings and lists (c) changes the page live (d) adds space around boxes
  10. 10.🎨 A CSS file usually ends with which extension? (a) .png (b) .js (c) .html (d) .css
  11. 11.🌈 Which colour is #0000ff? (a) blue (b) black (c) yellow (d) red
  12. 12.🖌️ What colour is behind the letters?
    h1 {
      background-color: green;
      font-size: 28px;
      color: red;
      text-align: right;
    }
    (a) green (b) purple (c) red
  13. 13.Which of these does CSS do? (a) sets colours and fonts (b) counts down a timer (c) gives the page structure (d) puts a picture on a page
  14. 14.🔍 Which is the odd one out? (a) counts down a timer (b) reacts to a button click (c) checks a quiz answer (d) makes a link
  15. 15.🌈 Which colour of light is strongest in rgb(82, 157, 25)? (a) blue (b) green (c) red
  16. 16.🎯 Which CSS selector matches this element?
    <span class="note" id="logo">Hello</span>
    (a) .logo (b) #end (c) p (d) .note
  17. 17.🖌️ Where does the text sit on its line?
    h2 {
      text-align: right;
      color: yellow;
      font-size: 32px;
      background-color: blue;
    }
    (a) on the left (b) in the middle (c) on the right
  18. 18.✍️ CSS declarations go inside which brackets? (a) < > (b) { } (c) [ ] (d) ( )
  19. 19.Which of these does HTML do? (a) puts a picture on a page (b) changes the text size (c) counts down a timer (d) shows a pop-up message
  20. 20.📦 In the box model, which part is the gap round content? (a) content (b) border (c) padding (d) margin
  21. 21.⚖️ What colour is the text of this element?
    <h2 class="star" id="end">Hi</h2>
    CSS:
    .star { color: purple; }
    .star { color: orange; }
    (a) purple (b) red (c) orange (d) white
  22. 22.✍️ What value is given to border in this rule?
    .note {
      border: 2px solid;
      margin: 10px;
    }
    (a) italic (b) border (c) 2px solid (d) 300px
  23. 23.✍️ Which sign goes between a property and its value? (a) : (b) = (c) ; (d) -
  24. 24.What does justify-content: flex-end do? (a) puts boxes in the middle (b) equal gaps, none at ends (c) packs boxes at the end (d) packs boxes at the start
  25. 25.🔍 Which is the odd one out? (a) makes headings and lists (b) makes a form box (c) changes the page live (d) gives the page structure
  26. 26.🌈 Which hex code is bright green? (a) #ffffff (b) #0000ff (c) #00ff00 (d) #ffff00
  27. 27.True or false: HTML puts a picture on a page. (a) True (b) False
  28. 28.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 28px;
      }
    }
  29. 29.🎯 Which CSS selector matches this element?
    <h2 class="menu" id="top">Hello</h2>
    (a) #menu (b) .menu (c) li (d) .top
  30. 30.🎯 Which sign starts a class selector? (a) # (b) . (c) & (d) @
  31. 31.🎯 Which element does the selector span style? (a) <p> (b) <h1 class="box"> (c) <span class="box"> (d) <h2 id="hero">
  32. 32.✍️ Which property is set to 10px in this rule?
    p {
      margin: 10px;
      text-align: center;
    }
    (a) font-weight (b) margin (c) 10px (d) padding
  33. 33.🔍 Which is the odd one out? (a) puts a picture on a page (b) sets colours and fonts (c) makes headings and lists (d) gives the page structure
  34. 34.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 80px;
      padding: 20px;
      border: 1px solid black;
      margin: 15px;
    }
  35. 35.🌈 Which colour is rgb(255, 0, 255)? (a) white (b) magenta (c) cyan (d) red
  36. 36.📱 min-width: 800px applies when the screen is ___. (a) exactly 100px (b) 800px or wider (c) turned off (d) 800px or narrower
  37. 37.🌈 Which colour of light is strongest in rgb(7, 71, 171)? (a) blue (b) red (c) green
  38. 38.🌈 Which colour is #ff0000? (a) cyan (b) yellow (c) red (d) black
  39. 39.🎯 Which sign starts an id selector? (a) @ (b) . (c) & (d) #
  40. 40.True or false: HTML shows a pop-up message. (a) True (b) False

Answer key

  1. 40
  2. 18
  3. background-color
  4. background-color
  5. <span id="logo">
  6. 20
  7. center
  8. color
  9. adds space around boxes
  10. .css
  11. blue
  12. green
  13. sets colours and fonts
  14. makes a link
  15. green
  16. .note
  17. on the right
  18. { }
  19. puts a picture on a page
  20. padding
  21. orange
  22. 2px solid
  23. :
  24. packs boxes at the end
  25. changes the page live
  26. #00ff00
  27. True
  28. 28
  29. .menu
  30. .
  31. <span class="box">
  32. margin
  33. sets colours and fonts
  34. 152
  35. magenta
  36. 800px or wider
  37. blue
  38. red
  39. #
  40. False

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