← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 585 · 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 is the biggest number one colour can have in rgb()? (a) 100 (b) 255 (c) 99 (d) 1000
  2. 2.What does justify-content: flex-end 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
  3. 3.🌈 Which colour is #00ff00? (a) bright green (b) red (c) blue (d) black
  4. 4.🎯 Which CSS selector matches this element?
    <span class="note" id="logo">Hello</span>
    (a) #note (b) .note (c) p (d) #end
  5. 5.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 260px;
      justify-content: flex-start;
    }
    Inside are 3 boxes, each 80px wide (no margins).
  6. 6.⚖️ Which selector is the strongest? (a) an element selector (b) a class selector (c) an id selector
  7. 7.📱 Which tag helps phones show a page at the right size? (a) the br tag (b) the hr tag (c) the title tag (d) the viewport meta tag
  8. 8.✍️ Which property is set to center in this rule?
    h1 {
      text-align: center;
      background-color: yellow;
    }
    (a) margin (b) background-color (c) center (d) text-align
  9. 9.✍️ How many declarations (property: value pairs) are in this rule?
    p {
      font-weight: bold;
      margin: 10px;
    }
  10. 10.🌈 Which colour is #ffff00? (a) bright green (b) blue (c) yellow (d) magenta
  11. 11.🌈 Which hex code is magenta? (a) #ff0000 (b) #ff00ff (c) #00ffff (d) #00ff00
  12. 12.🎨 Which tag connects an outside CSS file? (a) <img> (b) <a> (c) <link> (d) <css>
  13. 13.🎯 What kind of selector is .note? (a) an element selector (b) an id selector (c) a class selector
  14. 14.What does justify-content: flex-start do? (a) packs boxes at the start (b) puts boxes in the middle (c) equal gaps, none at ends (d) packs boxes at the end
  15. 15.📦 In the box model, which part is the gap round content? (a) border (b) content (c) margin (d) padding
  16. 16.What does font-weight do? (a) makes letters bigger (b) makes the text bold (c) sets the letter colour (d) colours behind the text
  17. 17.What does justify-content: center do? (a) equal gaps, none at ends (b) packs boxes at the end (c) packs boxes at the start (d) puts boxes in the middle
  18. 18.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 100px;
      justify-content: center;
    }
    Inside are 2 boxes, each 40px wide (no margins).
  19. 19.🎨 A CSS file usually ends with which extension? (a) .png (b) .js (c) .html (d) .css
  20. 20.⚖️ What colour is the text of this element?
    <h1 class="note" id="hero">Hi</h1>
    CSS:
    h1 { color: blue; }
    .note { color: yellow; }
    (a) yellow (b) blue (c) black (d) green
  21. 21.🎯 Which CSS selector matches this element?
    <li class="red" id="hero">Hello</li>
    (a) .box (b) div (c) li (d) #red
  22. 22.🎯 Which CSS selector matches this element?
    <div class="red" id="hero">Hello</div>
    (a) .box (b) #red (c) span (d) #hero
  23. 23.🧩 Which language gives the page structure? (a) HTML (b) JavaScript (c) CSS
  24. 24.What does font-size do? (a) sets the letter colour (b) makes letters bigger (c) makes the text bold (d) colours behind the text
  25. 25.✍️ How many declarations (property: value pairs) are in this rule?
    h2 {
      border: 2px solid;
      text-align: center;
    }
  26. 26.⚖️ What colour is the text of this element?
    <h1 class="note" id="logo">Hi</h1>
    CSS:
    h1 { color: white; }
    .note { color: purple; }
    (a) red (b) purple (c) black (d) white
  27. 27.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 230px;
      justify-content: flex-end;
    }
    Inside are 3 boxes, each 50px wide (no margins).
  28. 28.🔍 Which is the odd one out? (a) rounds box corners (b) adds space around boxes (c) changes the text size (d) reacts to a button click
  29. 29.True or false: CSS sets colours and fonts. (a) False (b) True
  30. 30.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 170px;
      justify-content: flex-start;
    }
    Inside are 4 boxes, each 40px wide (no margins).
  31. 31.⚖️ What colour is the text of this element?
    <p class="note" id="intro">Hi</p>
    CSS:
    #intro { color: yellow; }
    p { color: red; }
    (a) yellow (b) red (c) black (d) orange
  32. 32.✍️ What value is given to text-align in this rule?
    #top {
      border: 2px solid;
      text-align: center;
      font-weight: bold;
      font-style: italic;
    }
    (a) 10px (b) center (c) text-align (d) yellow
  33. 33.⚖️ What colour is the text of this element?
    <h2 class="star" id="top">Hi</h2>
    CSS:
    .star { color: purple; }
    .star { color: orange; }
    (a) green (b) purple (c) yellow (d) orange
  34. 34.What does font-family do? (a) picks the font style (b) sets the letter colour (c) makes letters bigger (d) colours behind the text
  35. 35.🖌️ How big is the text, in px?
    li {
      font-size: 28px;
      background-color: white;
      color: orange;
      text-align: center;
    }
  36. 36.✍️ In color: blue; which part is the property? (a) color (b) ; (c) : (d) blue
  37. 37.🌈 In #rrggbb, which colour do the last two digits give? (a) green (b) red (c) blue (d) white
  38. 38.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 190px;
      justify-content: flex-end;
    }
    Inside are 4 boxes, each 40px wide (no margins).
  39. 39.🌈 Which colour of light is strongest in rgb(53, 17, 245)? (a) red (b) blue (c) green
  40. 40.✍️ What value is given to padding in this rule?
    h1 {
      font-size: 20px;
      padding: 8px;
      color: red;
    }
    (a) 8px (b) padding (c) bold (d) 2px solid

Answer key

  1. 255
  2. packs boxes at the end
  3. bright green
  4. .note
  5. 20
  6. an id selector
  7. the viewport meta tag
  8. text-align
  9. 2
  10. yellow
  11. #ff00ff
  12. <link>
  13. a class selector
  14. packs boxes at the start
  15. padding
  16. makes the text bold
  17. puts boxes in the middle
  18. 10
  19. .css
  20. yellow
  21. li
  22. #hero
  23. HTML
  24. makes letters bigger
  25. 2
  26. purple
  27. 80
  28. reacts to a button click
  29. True
  30. 10
  31. yellow
  32. center
  33. orange
  34. picks the font style
  35. 28
  36. color
  37. blue
  38. 30
  39. blue
  40. 8px

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