← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 605 · 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 of light is strongest in rgb(81, 160, 85)? (a) red (b) green (c) blue
  2. 2.🎯 Which CSS selector matches this element?
    <h1 class="big" id="logo">Hello</h1>
    (a) .logo (b) h1 (c) h2 (d) #end
  3. 3.What does font-size do? (a) sets the letter colour (b) picks the font style (c) makes letters bigger (d) colours behind the text
  4. 4.🌈 What is the biggest number one colour can have in rgb()? (a) 1000 (b) 100 (c) 255 (d) 99
  5. 5.⚖️ What colour is the text of this element?
    <h2 class="big" id="logo">Hi</h2>
    CSS:
    .big { color: white; }
    #logo { color: black; }
    (a) white (b) green (c) black (d) red
  6. 6.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 24px;
      }
    }
  7. 7.📱 The screen is 1100px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 24px;
      }
    }
    (a) No (b) Yes
  8. 8.What does background-color do? (a) sets the letter colour (b) colours behind the text (c) makes the text bold (d) centres a heading
  9. 9.✍️ How many declarations (property: value pairs) are in this rule?
    h1 {
      text-align: center;
      width: 300px;
    }
  10. 10.🌈 Which colour is #00ff00? (a) blue (b) bright green (c) magenta (d) black
  11. 11.✍️ In color: blue; which part is the value? (a) color (b) ; (c) : (d) blue
  12. 12.🎯 Can many elements share the same class? (a) No (b) Yes
  13. 13.What does justify-content: space-between do? (a) packs boxes at the start (b) equal gaps, none at ends (c) puts boxes in the middle (d) packs boxes at the end
  14. 14.True or false: HTML makes a link. (a) True (b) False
  15. 15.Which of these does HTML do? (a) reacts to a button click (b) puts a picture on a page (c) adds space around boxes (d) shows a pop-up message
  16. 16.✍️ What is the selector in this CSS rule?
    #top {
      font-size: 20px;
      border: 2px solid;
    }
    (a) font-size (b) #top (c) 2px solid (d) li
  17. 17.Which of these is the border? (a) a solid or dotted edge (b) the gap to other boxes (c) space outside the border (d) the text or picture
  18. 18.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 320px;
      justify-content: flex-start;
    }
    Inside are 4 boxes, each 60px wide (no margins).
  19. 19.🌈 In #rrggbb, which colour do the last two digits give? (a) white (b) green (c) blue (d) red
  20. 20.⚖️ What colour is the text of this element?
    <h2 class="note" id="hero">Hi</h2>
    CSS:
    .note { color: orange; }
    .note { color: yellow; }
    (a) yellow (b) red (c) orange (d) white
  21. 21.💪 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).
  22. 22.⚖️ What colour is the text of this element?
    <p class="note" id="hero">Hi</p>
    CSS:
    .note { color: white; }
    .note { color: blue; }
    (a) white (b) blue (c) red (d) black
  23. 23.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 200px;
      padding: 5px;
      border: 5px solid black;
      margin: 0px;
    }
  24. 24.✍️ How many declarations (property: value pairs) are in this rule?
    li {
      background-color: yellow;
      width: 300px;
      text-align: center;
      font-style: italic;
    }
  25. 25.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the first one (b) the later one (c) the shorter one (d) neither
  26. 26.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 340px;
      justify-content: flex-start;
    }
    Inside are 3 boxes, each 100px wide (no margins).
  27. 27.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 200px;
      justify-content: flex-end;
    }
    Inside are 3 boxes, each 40px wide (no margins).
  28. 28.📱 What does a media query check? (a) the screen width (b) the time of day (c) the battery level (d) the page title
  29. 29.⚖️ Which selector is the strongest? (a) a class selector (b) an element selector (c) an id selector
  30. 30.🌈 Which colour is #ff0000? (a) magenta (b) black (c) blue (d) red
  31. 31.🎯 Which CSS selector matches this element?
    <div class="red" id="end">Hello</div>
    (a) #hero (b) #red (c) #end (d) .end
  32. 32.🎯 Which element does the selector #end style? (a) <li class="end"> (b) <li id="end"> (c) <li id="hero"> (d) <div class="box">
  33. 33.🌈 Which colour of light is strongest in rgb(29, 49, 208)? (a) blue (b) green (c) red
  34. 34.What does font-family do? (a) makes the text bold (b) sets the letter colour (c) colours behind the text (d) picks the font style
  35. 35.✍️ What value is given to font-style in this rule?
    .note {
      text-align: center;
      font-style: italic;
      padding: 8px;
    }
    (a) 20px (b) font-style (c) italic (d) red
  36. 36.⚖️ What colour is the text of this element?
    <p class="note" id="main">Hi</p>
    CSS:
    p { color: blue; }
    p { color: white; }
    (a) white (b) orange (c) blue (d) black
  37. 37.🖌️ What colour is behind the letters?
    h2 {
      text-align: center;
      font-size: 28px;
      background-color: orange;
      color: red;
    }
    (a) orange (b) blue (c) red
  38. 38.📱 The screen is 700px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 18px;
      }
    }
    (a) No (b) Yes
  39. 39.✍️ CSS declarations go inside which brackets? (a) [ ] (b) < > (c) { } (d) ( )
  40. 40.🌈 Which colour is rgb(255, 255, 0)? (a) white (b) bright green (c) black (d) yellow

Answer key

  1. green
  2. h1
  3. makes letters bigger
  4. 255
  5. black
  6. 24
  7. Yes
  8. colours behind the text
  9. 2
  10. bright green
  11. blue
  12. Yes
  13. equal gaps, none at ends
  14. True
  15. puts a picture on a page
  16. #top
  17. a solid or dotted edge
  18. 80
  19. blue
  20. yellow
  21. 80
  22. blue
  23. 220
  24. 4
  25. the later one
  26. 40
  27. 80
  28. the screen width
  29. an id selector
  30. red
  31. #end
  32. <li id="end">
  33. blue
  34. picks the font style
  35. italic
  36. white
  37. orange
  38. Yes
  39. { }
  40. yellow

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