← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 892 · 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 selector is the strongest? (a) an element selector (b) an id selector (c) a class selector
  2. 2.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 6px;
      }
    }
  3. 3.📱 The screen is 414px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 12px;
      }
    }
    (a) No (b) Yes
  4. 4.📱 max-width: 600px applies when the screen is ___. (a) 600px or wider (b) turned off (c) exactly 1000px (d) 600px or narrower
  5. 5.🌈 In #rrggbb, which colour do the first two digits give? (a) red (b) blue (c) black (d) green
  6. 6.⚖️ What colour is the text of this element?
    <p class="note" id="top">Hi</p>
    CSS:
    #top { color: white; }
    #top { color: green; }
    (a) red (b) white (c) purple (d) green
  7. 7.💪 Which justify-content value packs boxes at the start? (a) flex-start (b) center (c) flex-end (d) space-between
  8. 8.✍️ Which sign goes between a property and its value? (a) = (b) : (c) - (d) ;
  9. 9.🌈 Which colour is rgb(255, 0, 0)? (a) blue (b) red (c) white (d) bright green
  10. 10.✍️ What is the selector in this CSS rule?
    #top {
      width: 300px;
      margin: 10px;
      border: 2px solid;
      font-style: italic;
    }
    (a) #top (b) li (c) width (d) 10px
  11. 11.🌈 Which colour of light is strongest in rgb(86, 83, 198)? (a) green (b) blue (c) red
  12. 12.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 18px;
      }
    }
    (a) Yes (b) No
  13. 13.What does text-align do? (a) makes the text bold (b) makes letters bigger (c) colours behind the text (d) centres a heading
  14. 14.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 370px;
      justify-content: space-between;
    }
    Inside are 4 boxes, each 40px wide (no margins).
  15. 15.⚖️ What colour is the text of this element?
    <h2 class="big" id="top">Hi</h2>
    CSS:
    h2 { color: green; }
    h2 { color: orange; }
    (a) yellow (b) orange (c) blue (d) green
  16. 16.🖌️ What colour is behind the letters?
    li {
      background-color: orange;
      text-align: center;
      font-size: 32px;
      color: yellow;
    }
    (a) yellow (b) orange (c) red
  17. 17.🌈 Which colour of light is strongest in rgb(66, 120, 178)? (a) green (b) blue (c) red
  18. 18.True or false: padding is space outside the border. (a) True (b) False
  19. 19.✍️ What is the selector in this CSS rule?
    #top {
      font-weight: bold;
      border: 2px solid;
    }
    (a) #top (b) 2px solid (c) li (d) font-weight
  20. 20.💪 Which justify-content value equal gaps, none at ends? (a) flex-end (b) center (c) space-between (d) flex-start
  21. 21.⚖️ 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
  22. 22.⚖️ What colour is the text of this element?
    <h1 class="note" id="intro">Hi</h1>
    CSS:
    h1 { color: green; }
    #intro { color: black; }
    (a) purple (b) white (c) green (d) black
  23. 23.⚖️ What colour is the text of this element?
    <p class="star" id="end">Hi</p>
    CSS:
    #end { color: red; }
    p { color: white; }
    (a) white (b) orange (c) red (d) green
  24. 24.⚖️ What colour is the text of this element?
    <p class="box" id="top">Hi</p>
    CSS:
    .box { color: red; }
    .box { color: blue; }
    (a) red (b) yellow (c) blue (d) green
  25. 25.🎯 Which sign starts a class selector? (a) . (b) @ (c) & (d) #
  26. 26.🎯 Which element does the selector span style? (a) <span class="note"> (b) <p> (c) <h1 class="note"> (d) <h2 id="logo">
  27. 27.🖌️ What colour is behind the letters?
    p {
      text-align: right;
      font-size: 12px;
      color: red;
      background-color: yellow;
    }
    (a) red (b) yellow (c) orange
  28. 28.Which of these does JavaScript do? (a) reacts to a button click (b) adds space around boxes (c) rounds box corners (d) lays out the page
  29. 29.True or false: .card is an element selector. (a) False (b) True
  30. 30.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 50px;
      padding: 10px;
      border: 1px solid black;
      margin: 15px;
    }
  31. 31.🖌️ What colour is behind the letters?
    h2 {
      font-size: 32px;
      color: purple;
      text-align: left;
      background-color: black;
    }
    (a) purple (b) blue (c) black
  32. 32.🌈 In #00da00 the green part is the hex number da. What is it as a normal number?
  33. 33.🖌️ Where does the text sit on its line?
    li {
      font-size: 16px;
      background-color: yellow;
      color: red;
      text-align: center;
    }
    (a) on the left (b) on the right (c) in the middle
  34. 34.🌈 Which colour is #ff00ff? (a) cyan (b) blue (c) white (d) magenta
  35. 35.💪 Which flexbox property lines boxes up across? (a) justify-content (b) gap (c) flex-direction (d) align-items
  36. 36.⚖️ What colour is the text of this element?
    <p class="menu" id="hero">Hi</p>
    CSS:
    #hero { color: yellow; }
    #hero { color: blue; }
    (a) yellow (b) red (c) purple (d) blue
  37. 37.🌈 Which colour is rgb(255, 0, 255)? (a) cyan (b) yellow (c) magenta (d) bright green
  38. 38.🎯 Which CSS selector matches this element?
    <h1 class="menu" id="end">Hello</h1>
    (a) h2 (b) .end (c) .note (d) .menu
  39. 39.🖌️ What colour are the letters?
    h2 {
      font-size: 32px;
      background-color: blue;
      text-align: center;
      color: orange;
    }
    (a) white (b) orange (c) blue
  40. 40.✍️ What value is given to font-weight in this rule?
    p {
      font-weight: bold;
      color: red;
      text-align: center;
    }
    (a) 2px solid (b) 300px (c) font-weight (d) bold

Answer key

  1. an id selector
  2. 6
  3. Yes
  4. 600px or narrower
  5. red
  6. green
  7. flex-start
  8. :
  9. red
  10. #top
  11. blue
  12. No
  13. centres a heading
  14. 70
  15. orange
  16. orange
  17. blue
  18. False
  19. #top
  20. space-between
  21. the later one
  22. black
  23. red
  24. blue
  25. .
  26. <span class="note">
  27. yellow
  28. reacts to a button click
  29. False
  30. 102
  31. black
  32. 218
  33. in the middle
  34. magenta
  35. align-items
  36. blue
  37. magenta
  38. .menu
  39. orange
  40. bold

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