← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 922 · 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 colour is #ffffff? (a) magenta (b) black (c) white (d) cyan
  2. 2.🌈 Which hex code is red? (a) #ff0000 (b) #00ff00 (c) #ffff00 (d) #0000ff
  3. 3.🔍 Which is the odd one out? (a) puts a picture on a page (b) reacts to a button click (c) makes headings and lists (d) makes a form box
  4. 4.True or false: padding is the gap round content. (a) False (b) True
  5. 5.💪 Which flexbox property turns on flexbox? (a) display: flex (b) justify-content (c) gap (d) align-items
  6. 6.What does justify-content: space-between 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
  7. 7.🧩 Which language checks a quiz answer? (a) HTML (b) JavaScript (c) CSS
  8. 8.🖌️ Where does the text sit on its line?
    h2 {
      font-size: 36px;
      background-color: yellow;
      color: white;
      text-align: right;
    }
    (a) on the right (b) in the middle (c) on the left
  9. 9.🎨 Which tag holds CSS inside the head? (a) <script> (b) <css> (c) <style> (d) <body>
  10. 10.True or false: #logo is an element selector. (a) True (b) False
  11. 11.What does font-weight do? (a) sets the letter colour (b) makes the text bold (c) picks the font style (d) colours behind the text
  12. 12.🖌️ What colour is behind the letters?
    li {
      color: black;
      background-color: orange;
      font-size: 16px;
      text-align: center;
    }
    (a) orange (b) black (c) red
  13. 13.🌈 In #rrggbb, which colour do the first two digits give? (a) green (b) blue (c) red (d) black
  14. 14.🧩 Which language makes headings and lists? (a) JavaScript (b) CSS (c) HTML
  15. 15.📱 The screen is 540px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 24px;
      }
    }
    (a) No (b) Yes
  16. 16.🧩 Which language gives the page structure? (a) HTML (b) CSS (c) JavaScript
  17. 17.✍️ In color: blue; which part is the property? (a) blue (b) : (c) color (d) ;
  18. 18.What does background-color do? (a) makes letters bigger (b) colours behind the text (c) makes the text bold (d) picks the font style
  19. 19.✍️ Which sign ends each CSS declaration? (a) : (b) . (c) , (d) ;
  20. 20.🎯 Which element does the selector li style? (a) <li class="menu"> (b) <span class="menu"> (c) <div> (d) <p id="end">
  21. 21.📱 Which tag helps phones show a page at the right size? (a) the title tag (b) the viewport meta tag (c) the br tag (d) the hr tag
  22. 22.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 320px;
      justify-content: space-between;
    }
    Inside are 3 boxes, each 80px wide (no margins).
  23. 23.📱 The screen is 414px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 16px;
      }
    }
    (a) No (b) Yes
  24. 24.🌈 Which colour is rgb(255, 255, 255)? (a) black (b) red (c) cyan (d) white
  25. 25.🎯 Which sign starts a class selector? (a) . (b) & (c) # (d) @
  26. 26.🌈 Which colour of light is strongest in rgb(182, 13, 14)? (a) green (b) blue (c) red
  27. 27.📱 min-width: 800px applies when the screen is ___. (a) 800px or narrower (b) 800px or wider (c) turned off (d) exactly 100px
  28. 28.✍️ What value is given to font-weight in this rule?
    h2 {
      margin: 10px;
      font-weight: bold;
    }
    (a) 2px solid (b) font-weight (c) 300px (d) bold
  29. 29.💪 Which justify-content value puts boxes in the middle? (a) flex-start (b) flex-end (c) space-between (d) center
  30. 30.🖌️ How big is the text, in px?
    p {
      color: green;
      text-align: left;
      font-size: 36px;
      background-color: blue;
    }
  31. 31.True or false: the border is a solid or dotted edge. (a) True (b) False
  32. 32.✍️ How many declarations (property: value pairs) are in this rule?
    li {
      background-color: yellow;
      width: 300px;
    }
  33. 33.🎯 What kind of selector is p? (a) an id selector (b) a class selector (c) an element selector
  34. 34.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 14px;
      }
    }
  35. 35.🎯 Which CSS selector matches this element?
    <div class="note" id="intro">Hello</div>
    (a) .big (b) #note (c) span (d) div
  36. 36.⚖️ What colour is the text of this element?
    <h2 class="star" id="top">Hi</h2>
    CSS:
    .star { color: black; }
    h2 { color: red; }
    (a) orange (b) red (c) black (d) white
  37. 37.⚖️ What colour is the text of this element?
    <h2 class="box" id="main">Hi</h2>
    CSS:
    #main { color: white; }
    #main { color: black; }
    (a) white (b) orange (c) red (d) black
  38. 38.🖌️ Where does the text sit on its line?
    h2 {
      text-align: left;
      color: yellow;
      background-color: green;
      font-size: 24px;
    }
    (a) in the middle (b) on the right (c) on the left
  39. 39.🧩 Which language changes the text size? (a) HTML (b) CSS (c) JavaScript
  40. 40.🧩 Which language changes the page live? (a) JavaScript (b) HTML (c) CSS

Answer key

  1. white
  2. #ff0000
  3. reacts to a button click
  4. True
  5. display: flex
  6. equal gaps, none at ends
  7. JavaScript
  8. on the right
  9. <style>
  10. False
  11. makes the text bold
  12. orange
  13. red
  14. HTML
  15. Yes
  16. HTML
  17. color
  18. colours behind the text
  19. ;
  20. <li class="menu">
  21. the viewport meta tag
  22. 40
  23. No
  24. white
  25. .
  26. red
  27. 800px or wider
  28. bold
  29. center
  30. 36
  31. True
  32. 2
  33. an element selector
  34. 14
  35. div
  36. black
  37. black
  38. on the left
  39. CSS
  40. JavaScript

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