← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 523 · 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 a media query check? (a) the screen width (b) the time of day (c) the page title (d) the battery level
  2. 2.✍️ Which property is set to red in this rule?
    .note {
      width: 300px;
      padding: 8px;
      color: red;
    }
    (a) font-size (b) red (c) color (d) text-align
  3. 3.🔍 Which is the odd one out? (a) lays out the page (b) makes a link (c) gives the page structure (d) makes a form box
  4. 4.🎨 Which attribute adds CSS inside one tag? (a) alt (b) href (c) style (d) src
  5. 5.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 18px;
      }
    }
  6. 6.🎯 Which element does the selector li style? (a) <div> (b) <span class="menu"> (c) <p id="end"> (d) <li class="menu">
  7. 7.💪 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).
  8. 8.🎨 A CSS file usually ends with which extension? (a) .css (b) .js (c) .html (d) .png
  9. 9.✍️ What value is given to border in this rule?
    li {
      font-style: italic;
      padding: 8px;
      border: 2px solid;
      font-size: 20px;
    }
    (a) italic (b) 300px (c) 2px solid (d) border
  10. 10.🎯 Which CSS selector matches this element?
    <span class="note" id="top">Hello</span>
    (a) .top (b) #note (c) .big (d) .note
  11. 11.⚖️ What colour is the text of this element?
    <p class="menu" id="intro">Hi</p>
    CSS:
    p { color: red; }
    p { color: blue; }
    (a) white (b) red (c) orange (d) blue
  12. 12.🖌️ What colour are the letters?
    li {
      background-color: blue;
      font-size: 32px;
      text-align: right;
      color: yellow;
    }
    (a) yellow (b) blue (c) black
  13. 13.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 200px;
      padding: 20px;
      border: 5px solid black;
      margin: 5px;
    }
  14. 14.True or false: .menu is a class selector. (a) False (b) True
  15. 15.✍️ What value is given to font-style in this rule?
    li {
      font-style: italic;
      width: 300px;
      font-size: 20px;
    }
    (a) red (b) 20px (c) font-style (d) italic
  16. 16.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 240px;
      justify-content: center;
    }
    Inside are 2 boxes, each 50px wide (no margins).
  17. 17.🎯 Which CSS selector matches this element?
    <li class="big" id="end">Hello</li>
    (a) div (b) #hero (c) .red (d) li
  18. 18.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 18px;
      }
    }
  19. 19.🖌️ What colour are the letters?
    h1 {
      font-size: 40px;
      background-color: orange;
      text-align: right;
      color: blue;
    }
    (a) orange (b) black (c) blue
  20. 20.🎯 Which sign starts an id selector? (a) . (b) & (c) # (d) @
  21. 21.📱 The screen is 1366px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 28px;
      }
    }
    (a) Yes (b) No
  22. 22.⚖️ Which selector is the weakest? (a) an element selector (b) a class selector (c) an id selector
  23. 23.🎯 Which element does the selector h1 style? (a) <li class="note"> (b) <h2> (c) <div id="intro"> (d) <h1 class="note">
  24. 24.🎯 Which CSS selector matches this element?
    <div class="red" id="logo">Hello</div>
    (a) #end (b) #logo (c) .logo (d) .box
  25. 25.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 3 (b) 2 (c) 6 (d) 4
  26. 26.✍️ What is the selector in this CSS rule?
    p {
      color: red;
      font-size: 20px;
    }
    (a) .note (b) 20px (c) p (d) color
  27. 27.🌈 Which colour of light is strongest in rgb(220, 53, 129)? (a) green (b) red (c) blue
  28. 28.⚖️ What colour is the text of this element?
    <h2 class="red" id="intro">Hi</h2>
    CSS:
    #intro { color: purple; }
    h2 { color: red; }
    .red { color: blue; }
    (a) purple (b) blue (c) red (d) yellow
  29. 29.✍️ What value is given to width in this rule?
    .note {
      width: 300px;
      margin: 10px;
      text-align: center;
    }
    (a) 300px (b) red (c) width (d) italic
  30. 30.🌈 Which colour is rgb(0, 0, 0)? (a) bright green (b) black (c) red (d) yellow
  31. 31.✍️ Which sign ends each CSS declaration? (a) , (b) ; (c) : (d) .
  32. 32.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 40px;
      padding: 30px;
      border: 2px solid black;
      margin: 0px;
    }
  33. 33.What does justify-content: center do? (a) packs boxes at the end (b) packs boxes at the start (c) equal gaps, none at ends (d) puts boxes in the middle
  34. 34.🎯 What kind of selector is .note? (a) an id selector (b) an element selector (c) a class selector
  35. 35.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 24px;
      }
    }
  36. 36.🧩 Which language adds space around boxes? (a) HTML (b) CSS (c) JavaScript
  37. 37.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 28px;
      }
    }
  38. 38.⚖️ What colour is the text of this element?
    <p class="note" id="hero">Hi</p>
    CSS:
    #hero { color: white; }
    #hero { color: black; }
    (a) white (b) black (c) green (d) orange
  39. 39.✍️ What is the selector in this CSS rule?
    h1 {
      padding: 8px;
      text-align: center;
      color: red;
      width: 300px;
    }
    (a) center (b) padding (c) p (d) h1
  40. 40.Which of these does JavaScript do? (a) lays out the page (b) reacts to a button click (c) puts a picture on a page (d) makes a link

Answer key

  1. the screen width
  2. color
  3. lays out the page
  4. style
  5. 24
  6. <li class="menu">
  7. 40
  8. .css
  9. 2px solid
  10. .note
  11. blue
  12. yellow
  13. 260
  14. True
  15. italic
  16. 70
  17. li
  18. 18
  19. blue
  20. #
  21. Yes
  22. an element selector
  23. <h1 class="note">
  24. #logo
  25. 3
  26. p
  27. red
  28. purple
  29. 300px
  30. black
  31. ;
  32. 104
  33. puts boxes in the middle
  34. a class selector
  35. 16
  36. CSS
  37. 20
  38. black
  39. h1
  40. reacts to a button click

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