← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 97 · 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.What does background-color do? (a) makes letters bigger (b) colours behind the text (c) sets the letter colour (d) makes the text bold
  2. 2.🔍 Which is the odd one out? (a) checks a quiz answer (b) counts down a timer (c) makes headings and lists (d) changes the page live
  3. 3.🎨 A CSS file usually ends with which extension? (a) .png (b) .js (c) .html (d) .css
  4. 4.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 20px;
      }
    }
  5. 5.What does justify-content: center do? (a) puts boxes in the middle (b) packs boxes at the start (c) packs boxes at the end (d) equal gaps, none at ends
  6. 6.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 150px;
      padding: 25px;
      border: 4px solid black;
      margin: 10px;
    }
  7. 7.⚖️ What colour is the text of this element?
    <p class="big" id="logo">Hi</p>
    CSS:
    .big { color: yellow; }
    #logo { color: black; }
    (a) green (b) black (c) yellow (d) blue
  8. 8.✍️ Which property is set to red in this rule?
    li {
      text-align: center;
      color: red;
      margin: 10px;
      width: 300px;
    }
    (a) color (b) font-size (c) red (d) text-align
  9. 9.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 40px;
      padding: 20px;
      border: 5px solid black;
      margin: 15px;
    }
  10. 10.📱 min-width: 800px applies when the screen is ___. (a) turned off (b) 800px or narrower (c) 800px or wider (d) exactly 100px
  11. 11.🎯 Which element does the selector div style? (a) <p class="star"> (b) <span> (c) <h1 id="intro"> (d) <div class="star">
  12. 12.⚖️ What colour is the text of this element?
    <h2 class="note" id="logo">Hi</h2>
    CSS:
    h2 { color: white; }
    #logo { color: red; }
    .note { color: purple; }
    (a) green (b) white (c) purple (d) red
  13. 13.💪 Which justify-content value equal gaps, none at ends? (a) space-between (b) flex-end (c) center (d) flex-start
  14. 14.Which of these does HTML do? (a) rounds box corners (b) counts down a timer (c) sets colours and fonts (d) makes headings and lists
  15. 15.Which of these does CSS do? (a) makes headings and lists (b) reacts to a button click (c) makes a form box (d) sets colours and fonts
  16. 16.💪 Which justify-content value puts boxes in the middle? (a) space-between (b) flex-start (c) center (d) flex-end
  17. 17.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 10px;
      }
    }
  18. 18.🧩 Which language reacts to a button click? (a) HTML (b) CSS (c) JavaScript
  19. 19.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 80px;
      padding: 10px;
      border: 5px solid black;
      margin: 5px;
    }
  20. 20.Which of these does HTML do? (a) sets colours and fonts (b) puts a picture on a page (c) checks a quiz answer (d) counts down a timer
  21. 21.🧩 Which language adds space around boxes? (a) CSS (b) HTML (c) JavaScript
  22. 22.🖌️ Where does the text sit on its line?
    h1 {
      color: black;
      text-align: left;
      background-color: purple;
      font-size: 32px;
    }
    (a) on the left (b) in the middle (c) on the right
  23. 23.⚖️ What colour is the text of this element?
    <p class="star" id="top">Hi</p>
    CSS:
    p { color: white; }
    #top { color: green; }
    (a) green (b) orange (c) purple (d) white
  24. 24.✍️ How does a CSS comment start? (a) <!-- (b) /* (c) # (d) //
  25. 25.What does justify-content: flex-start do? (a) packs boxes at the start (b) packs boxes at the end (c) puts boxes in the middle (d) equal gaps, none at ends
  26. 26.✍️ What value is given to margin in this rule?
    li {
      text-align: center;
      color: red;
      margin: 10px;
      border: 2px solid;
    }
    (a) 8px (b) bold (c) 10px (d) margin
  27. 27.✍️ Which property is set to 10px in this rule?
    h1 {
      background-color: yellow;
      width: 300px;
      font-size: 20px;
      margin: 10px;
    }
    (a) padding (b) margin (c) 10px (d) font-weight
  28. 28.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 18px;
      }
    }
  29. 29.🎨 What does CSS stand for? (a) Cascading Style Sheets (b) Colourful Site Styles (c) Computer Style Sheets (d) Creative Sheet System
  30. 30.✍️ How many declarations (property: value pairs) are in this rule?
    h2 {
      font-weight: bold;
    }
  31. 31.✍️ CSS declarations go inside which brackets? (a) ( ) (b) [ ] (c) < > (d) { }
  32. 32.🔍 Which is the odd one out? (a) lays out the page (b) makes a link (c) makes a form box (d) makes headings and lists
  33. 33.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 290px;
      justify-content: flex-start;
    }
    Inside are 3 boxes, each 80px wide (no margins).
  34. 34.💪 Which flexbox property turns on flexbox? (a) display: flex (b) align-items (c) flex-direction (d) justify-content
  35. 35.🌈 Which colour of light is strongest in rgb(7, 174, 88)? (a) green (b) red (c) blue
  36. 36.🎨 Which tag holds CSS inside the head? (a) <body> (b) <script> (c) <css> (d) <style>
  37. 37.📱 The screen is 820px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 20px;
      }
    }
    (a) Yes (b) No
  38. 38.🌈 Which colour is rgb(255, 0, 0)? (a) red (b) blue (c) white (d) cyan
  39. 39.✍️ Which property is set to 2px solid in this rule?
    #top {
      border: 2px solid;
      font-weight: bold;
    }
    (a) 2px solid (b) width (c) border (d) font-style
  40. 40.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 150px;
      padding: 30px;
      border: 1px solid black;
      margin: 0px;
    }

Answer key

  1. colours behind the text
  2. makes headings and lists
  3. .css
  4. 20
  5. puts boxes in the middle
  6. 208
  7. black
  8. color
  9. 120
  10. 800px or wider
  11. <div class="star">
  12. red
  13. space-between
  14. makes headings and lists
  15. sets colours and fonts
  16. center
  17. 10
  18. JavaScript
  19. 120
  20. puts a picture on a page
  21. CSS
  22. on the left
  23. green
  24. /*
  25. packs boxes at the start
  26. 10px
  27. margin
  28. 18
  29. Cascading Style Sheets
  30. 1
  31. { }
  32. lays out the page
  33. 50
  34. display: flex
  35. green
  36. <style>
  37. No
  38. red
  39. border
  40. 212

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