← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 18 · 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.Which of these does HTML do? (a) shows a pop-up message (b) changes the page live (c) reacts to a button click (d) puts a picture on a page
  2. 2.🌈 Which colour is #00ff00? (a) black (b) yellow (c) cyan (d) bright green
  3. 3.🎨 What does CSS stand for? (a) Colourful Site Styles (b) Computer Style Sheets (c) Creative Sheet System (d) Cascading Style Sheets
  4. 4.💪 Which justify-content value puts boxes in the middle? (a) space-between (b) flex-start (c) center (d) flex-end
  5. 5.💪 Which flexbox property sets space between boxes? (a) align-items (b) gap (c) flex-direction (d) display: flex
  6. 6.✍️ Which property is set to center in this rule?
    p {
      text-align: center;
      padding: 8px;
      margin: 10px;
    }
    (a) margin (b) center (c) text-align (d) background-color
  7. 7.✍️ What value is given to font-size in this rule?
    h2 {
      font-size: 20px;
      font-style: italic;
    }
    (a) font-size (b) center (c) yellow (d) 20px
  8. 8.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 12px;
      }
    }
  9. 9.📱 max-width: 600px applies when the screen is ___. (a) exactly 1000px (b) 600px or wider (c) turned off (d) 600px or narrower
  10. 10.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 20px;
      }
    }
  11. 11.✍️ What is the selector in this CSS rule?
    body {
      width: 300px;
      padding: 8px;
    }
    (a) body (b) width (c) .box (d) 8px
  12. 12.What does font-size do? (a) makes letters bigger (b) makes the text bold (c) colours behind the text (d) centres a heading
  13. 13.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 18px;
      }
    }
  14. 14.📱 Responsive design means a page ___. (a) has no pictures (b) is only for laptops (c) fits every screen (d) never changes
  15. 15.🌈 Which hex code is magenta? (a) #ff00ff (b) #00ff00 (c) #0000ff (d) #ffffff
  16. 16.🔍 Which is the odd one out? (a) lays out the page (b) gives the page structure (c) sets colours and fonts (d) adds space around boxes
  17. 17.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 22px;
      }
    }
  18. 18.Which of these does JavaScript do? (a) gives the page structure (b) lays out the page (c) shows a pop-up message (d) puts a picture on a page
  19. 19.🎯 Can many elements share the same class? (a) Yes (b) No
  20. 20.✍️ What value is given to width in this rule?
    .note {
      width: 300px;
      text-align: center;
    }
    (a) italic (b) red (c) 300px (d) width
  21. 21.🧩 Which language changes the text size? (a) HTML (b) CSS (c) JavaScript
  22. 22.🖌️ Which CSS property centres a heading? (a) font-size (b) text-align (c) color (d) background-color
  23. 23.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 270px;
      justify-content: flex-end;
    }
    Inside are 2 boxes, each 100px wide (no margins).
  24. 24.📦 In the box model, which part is space inside the border? (a) content (b) margin (c) padding (d) border
  25. 25.🔍 Which is the odd one out? (a) makes headings and lists (b) gives the page structure (c) checks a quiz answer (d) puts a picture on a page
  26. 26.✍️ How many declarations (property: value pairs) are in this rule?
    h2 {
      border: 2px solid;
      text-align: center;
      font-weight: bold;
    }
  27. 27.📦 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: 20px;
      border: 1px solid black;
      margin: 10px;
    }
  28. 28.⚖️ What colour is the text of this element?
    <h2 class="menu" id="end">Hi</h2>
    CSS:
    h2 { color: blue; }
    #end { color: black; }
    .menu { color: green; }
    (a) green (b) orange (c) blue (d) black
  29. 29.🖌️ What colour are the letters?
    li {
      text-align: right;
      background-color: orange;
      color: green;
      font-size: 40px;
    }
    (a) yellow (b) orange (c) green
  30. 30.🎯 Which sign starts a class selector? (a) . (b) & (c) # (d) @
  31. 31.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the first one (b) the shorter one (c) neither (d) the later one
  32. 32.🖌️ What colour is behind the letters?
    p {
      text-align: left;
      color: white;
      background-color: red;
      font-size: 20px;
    }
    (a) green (b) white (c) red
  33. 33.Which of these is the content? (a) the gap round content (b) the text or picture (c) space inside the border (d) the gap to other boxes
  34. 34.✍️ How many declarations (property: value pairs) are in this rule?
    h1 {
      font-style: italic;
      font-size: 20px;
    }
  35. 35.🌈 Which colour is #ff0000? (a) bright green (b) black (c) white (d) red
  36. 36.⚖️ What colour is the text of this element?
    <p class="box" id="main">Hi</p>
    CSS:
    p { color: orange; }
    .box { color: white; }
    #main { color: yellow; }
    (a) black (b) white (c) orange (d) yellow
  37. 37.🖌️ Which CSS property makes the text bold? (a) font-weight (b) font-size (c) background-color (d) color
  38. 38.🖌️ Which CSS property colours behind the text? (a) font-family (b) font-weight (c) font-size (d) background-color
  39. 39.🌈 Which colour is #ffffff? (a) white (b) blue (c) magenta (d) bright green
  40. 40.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 14px;
      }
    }

Answer key

  1. puts a picture on a page
  2. bright green
  3. Cascading Style Sheets
  4. center
  5. gap
  6. text-align
  7. 20px
  8. 16
  9. 600px or narrower
  10. 20
  11. body
  12. makes letters bigger
  13. 12
  14. fits every screen
  15. #ff00ff
  16. gives the page structure
  17. 22
  18. shows a pop-up message
  19. Yes
  20. 300px
  21. CSS
  22. text-align
  23. 70
  24. padding
  25. checks a quiz answer
  26. 3
  27. 272
  28. black
  29. green
  30. .
  31. the later one
  32. red
  33. the text or picture
  34. 2
  35. red
  36. yellow
  37. font-weight
  38. background-color
  39. white
  40. 14

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