← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 309 · 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 CSS property colours behind the text? (a) font-size (b) background-color (c) color (d) font-family
  2. 2.What does justify-content: center do? (a) packs boxes at the start (b) puts boxes in the middle (c) packs boxes at the end (d) equal gaps, none at ends
  3. 3.🔍 Which is the odd one out? (a) puts a picture on a page (b) sets colours and fonts (c) gives the page structure (d) makes a form box
  4. 4.🖌️ What colour is behind the letters?
    h1 {
      color: white;
      background-color: red;
      text-align: center;
      font-size: 12px;
    }
    (a) yellow (b) red (c) white
  5. 5.⚖️ What colour is the text of this element?
    <h1 class="red" id="top">Hi</h1>
    CSS:
    .red { color: orange; }
    .red { color: green; }
    (a) green (b) red (c) orange (d) blue
  6. 6.💪 Which flexbox property picks row or column? (a) display: flex (b) justify-content (c) align-items (d) flex-direction
  7. 7.🎨 A CSS file usually ends with which extension? (a) .png (b) .html (c) .js (d) .css
  8. 8.🧩 Which language gives the page structure? (a) HTML (b) CSS (c) JavaScript
  9. 9.What does justify-content: flex-start do? (a) puts boxes in the middle (b) packs boxes at the start (c) equal gaps, none at ends (d) packs boxes at the end
  10. 10.🌈 Which hex code is cyan? (a) #00ffff (b) #00ff00 (c) #ff0000 (d) #ff00ff
  11. 11.✍️ What value is given to width in this rule?
    .note {
      font-weight: bold;
      padding: 8px;
      width: 300px;
    }
    (a) italic (b) red (c) 300px (d) width
  12. 12.✍️ How many declarations (property: value pairs) are in this rule?
    .box {
      font-size: 20px;
      padding: 8px;
      text-align: center;
    }
  13. 13.Which of these is margin? (a) the gap to other boxes (b) the gap round content (c) space inside the border (d) a solid or dotted edge
  14. 14.🖌️ What colour is behind the letters?
    h1 {
      background-color: orange;
      font-size: 32px;
      color: blue;
      text-align: left;
    }
    (a) blue (b) orange (c) black
  15. 15.✍️ Which property is set to 300px in this rule?
    .note {
      font-style: italic;
      border: 2px solid;
      width: 300px;
    }
    (a) width (b) font-style (c) 300px (d) color
  16. 16.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 70px;
      padding: 30px;
      border: 1px solid black;
      margin: 20px;
    }
  17. 17.📱 min-width: 800px applies when the screen is ___. (a) turned off (b) 800px or wider (c) exactly 100px (d) 800px or narrower
  18. 18.🌈 What is the biggest number one colour can have in rgb()? (a) 255 (b) 99 (c) 1000 (d) 100
  19. 19.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 220px;
      justify-content: center;
    }
    Inside are 4 boxes, each 40px wide (no margins).
  20. 20.📱 What does a media query check? (a) the time of day (b) the screen width (c) the page title (d) the battery level
  21. 21.⚖️ What colour is the text of this element?
    <p class="red" id="intro">Hi</p>
    CSS:
    .red { color: orange; }
    .red { color: blue; }
    (a) black (b) red (c) orange (d) blue
  22. 22.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 22px;
      }
    }
  23. 23.🎯 Which CSS selector matches this element?
    <p class="star" id="intro">Hello</p>
    (a) #main (b) .menu (c) .star (d) .intro
  24. 24.🎯 Which sign starts a class selector? (a) . (b) & (c) # (d) @
  25. 25.⚖️ What colour is the text of this element?
    <p class="box" id="intro">Hi</p>
    CSS:
    p { color: red; }
    p { color: blue; }
    (a) red (b) blue (c) green (d) black
  26. 26.Which of these does JavaScript do? (a) rounds box corners (b) makes headings and lists (c) reacts to a button click (d) sets colours and fonts
  27. 27.⚖️ What colour is the text of this element?
    <p class="note" id="end">Hi</p>
    CSS:
    #end { color: green; }
    p { color: purple; }
    .note { color: orange; }
    (a) black (b) orange (c) green (d) purple
  28. 28.🎯 Which element does the selector #top style? (a) <li class="top"> (b) <li id="top"> (c) <div class="big"> (d) <li id="intro">
  29. 29.⚖️ What colour is the text of this element?
    <p class="star" id="intro">Hi</p>
    CSS:
    p { color: blue; }
    .star { color: orange; }
    (a) red (b) blue (c) green (d) orange
  30. 30.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 26px;
      }
    }
  31. 31.🎯 Which element does the selector .note style? (a) <h1 class="red"> (b) <p class="big"> (c) <p class="note"> (d) <p id="note">
  32. 32.✍️ How does a CSS comment start? (a) <!-- (b) // (c) # (d) /*
  33. 33.Which of these does HTML do? (a) changes the text size (b) checks a quiz answer (c) shows a pop-up message (d) makes a form box
  34. 34.🌈 Which hex code is bright green? (a) #ffff00 (b) #ff00ff (c) #00ff00 (d) #00ffff
  35. 35.✍️ Which property is set to center in this rule?
    p {
      font-weight: bold;
      width: 300px;
      font-size: 20px;
      text-align: center;
    }
    (a) margin (b) center (c) background-color (d) text-align
  36. 36.🌈 Which hex code is blue? (a) #0000ff (b) #000000 (c) #ff00ff (d) #ffffff
  37. 37.What does background-color do? (a) picks the font style (b) colours behind the text (c) makes letters bigger (d) centres a heading
  38. 38.🔍 Which is the odd one out? (a) gives the page structure (b) makes a link (c) lays out the page (d) makes a form box
  39. 39.🖌️ What colour are the letters?
    p {
      text-align: left;
      background-color: black;
      font-size: 12px;
      color: yellow;
    }
    (a) black (b) yellow (c) blue
  40. 40.🖌️ Which CSS property makes letters bigger? (a) font-family (b) color (c) font-size (d) text-align

Answer key

  1. background-color
  2. puts boxes in the middle
  3. sets colours and fonts
  4. red
  5. green
  6. flex-direction
  7. .css
  8. HTML
  9. packs boxes at the start
  10. #00ffff
  11. 300px
  12. 3
  13. the gap to other boxes
  14. orange
  15. width
  16. 172
  17. 800px or wider
  18. 255
  19. 30
  20. the screen width
  21. blue
  22. 16
  23. .star
  24. .
  25. blue
  26. reacts to a button click
  27. green
  28. <li id="top">
  29. orange
  30. 24
  31. <p class="note">
  32. /*
  33. makes a form box
  34. #00ff00
  35. text-align
  36. #0000ff
  37. colours behind the text
  38. lays out the page
  39. yellow
  40. font-size

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