← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 315 · 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.True or false: img is a class selector. (a) True (b) False
  2. 2.Which of these does HTML do? (a) shows a pop-up message (b) makes a form box (c) lays out the page (d) sets colours and fonts
  3. 3.🌈 Which hex code is white? (a) #ffff00 (b) #00ffff (c) #ff0000 (d) #ffffff
  4. 4.True or false: the content is the text or picture. (a) False (b) True
  5. 5.💪 Which justify-content value equal gaps, none at ends? (a) flex-start (b) center (c) flex-end (d) space-between
  6. 6.🖌️ What colour are the letters?
    p {
      font-size: 20px;
      text-align: left;
      background-color: blue;
      color: black;
    }
    (a) blue (b) black (c) green
  7. 7.True or false: HTML changes the page live. (a) False (b) True
  8. 8.🖌️ What colour is behind the letters?
    li {
      font-size: 28px;
      background-color: white;
      text-align: right;
      color: yellow;
    }
    (a) blue (b) white (c) yellow
  9. 9.🧩 Which language shows a pop-up message? (a) JavaScript (b) CSS (c) HTML
  10. 10.✍️ Which sign ends each CSS declaration? (a) , (b) . (c) ; (d) :
  11. 11.True or false: h1 is an id selector. (a) True (b) False
  12. 12.💪 Which justify-content value puts boxes in the middle? (a) space-between (b) flex-start (c) flex-end (d) center
  13. 13.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 110px;
      padding: 5px;
      border: 1px solid black;
      margin: 5px;
    }
  14. 14.🧩 Which language makes a form box? (a) CSS (b) HTML (c) JavaScript
  15. 15.✍️ Which property is set to red in this rule?
    .box {
      font-style: italic;
      color: red;
      background-color: yellow;
    }
    (a) color (b) text-align (c) font-size (d) red
  16. 16.True or false: body is a class selector. (a) True (b) False
  17. 17.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 28px;
      }
    }
  18. 18.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 50px;
      padding: 25px;
      border: 3px solid black;
      margin: 10px;
    }
  19. 19.✍️ Which property is set to yellow in this rule?
    #top {
      background-color: yellow;
      width: 300px;
    }
    (a) background-color (b) yellow (c) padding (d) margin
  20. 20.🌈 Which colour is #ffffff? (a) cyan (b) red (c) white (d) yellow
  21. 21.Which of these is padding? (a) space outside the border (b) a solid or dotted edge (c) the gap round content (d) the line round the box
  22. 22.🖌️ How big is the text, in px?
    li {
      color: purple;
      font-size: 24px;
      text-align: left;
      background-color: green;
    }
  23. 23.True or false: JavaScript changes the page live. (a) False (b) True
  24. 24.🌈 What is the biggest number one colour can have in rgb()? (a) 255 (b) 99 (c) 100 (d) 1000
  25. 25.🔍 Which is the odd one out? (a) lays out the page (b) changes the text size (c) sets colours and fonts (d) makes a form box
  26. 26.✍️ What is the selector in this CSS rule?
    h2 {
      font-style: italic;
      background-color: yellow;
      font-size: 20px;
    }
    (a) yellow (b) font-style (c) h2 (d) h1
  27. 27.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 14px;
      }
    }
  28. 28.✍️ What is the selector in this CSS rule?
    p {
      font-size: 20px;
      font-weight: bold;
    }
    (a) bold (b) p (c) .note (d) font-size
  29. 29.🎨 One CSS file can style how many pages? (a) only one word (b) only one image (c) no pages (d) many pages
  30. 30.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 430px;
      justify-content: space-between;
    }
    Inside are 4 boxes, each 100px wide (no margins).
  31. 31.🔍 Which is the odd one out? (a) sets colours and fonts (b) adds space around boxes (c) changes the text size (d) reacts to a button click
  32. 32.Which of these does CSS do? (a) makes a form box (b) puts a picture on a page (c) reacts to a button click (d) sets colours and fonts
  33. 33.✍️ How does a CSS comment start? (a) <!-- (b) # (c) /* (d) //
  34. 34.🖌️ Where does the text sit on its line?
    h2 {
      font-size: 12px;
      color: blue;
      text-align: center;
      background-color: green;
    }
    (a) on the left (b) in the middle (c) on the right
  35. 35.🎯 What kind of selector is .note? (a) an id selector (b) an element selector (c) a class selector
  36. 36.✍️ CSS declarations go inside which brackets? (a) ( ) (b) < > (c) { } (d) [ ]
  37. 37.💪 Which flexbox property lines boxes up across? (a) display: flex (b) justify-content (c) align-items (d) flex-direction
  38. 38.What does color do? (a) makes the text bold (b) centres a heading (c) sets the letter colour (d) makes letters bigger
  39. 39.Which of these is margin? (a) a solid or dotted edge (b) space inside the border (c) the gap round content (d) the gap to other boxes
  40. 40.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 10px;
      }
    }

Answer key

  1. False
  2. makes a form box
  3. #ffffff
  4. True
  5. space-between
  6. black
  7. False
  8. white
  9. JavaScript
  10. ;
  11. False
  12. center
  13. 132
  14. HTML
  15. color
  16. False
  17. 24
  18. 106
  19. background-color
  20. white
  21. the gap round content
  22. 24
  23. True
  24. 255
  25. makes a form box
  26. h2
  27. 14
  28. p
  29. many pages
  30. 10
  31. reacts to a button click
  32. sets colours and fonts
  33. /*
  34. in the middle
  35. a class selector
  36. { }
  37. align-items
  38. sets the letter colour
  39. the gap to other boxes
  40. 12

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