← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 602 · 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 #ffff00? (a) white (b) bright green (c) yellow (d) black
  2. 2.✍️ What value is given to text-align in this rule?
    h1 {
      font-size: 20px;
      text-align: center;
    }
    (a) text-align (b) center (c) 10px (d) yellow
  3. 3.✍️ How many declarations (property: value pairs) are in this rule?
    p {
      padding: 8px;
      text-align: center;
    }
  4. 4.📱 The screen is 414px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 22px;
      }
    }
    (a) Yes (b) No
  5. 5.🖌️ Which CSS property picks the font style? (a) font-family (b) text-align (c) font-size (d) font-weight
  6. 6.✍️ Which property is set to 300px in this rule?
    li {
      padding: 8px;
      text-align: center;
      width: 300px;
      font-size: 20px;
    }
    (a) width (b) font-style (c) color (d) 300px
  7. 7.⚖️ What colour is the text of this element?
    <h1 class="star" id="logo">Hi</h1>
    CSS:
    h1 { color: green; }
    .star { color: blue; }
    (a) green (b) purple (c) black (d) blue
  8. 8.⚖️ Which selector is the strongest? (a) a class selector (b) an element selector (c) an id selector
  9. 9.🖌️ Which CSS property makes the text bold? (a) color (b) font-family (c) text-align (d) font-weight
  10. 10.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 200px;
      justify-content: space-between;
    }
    Inside are 2 boxes, each 80px wide (no margins).
  11. 11.Which of these does CSS do? (a) shows a pop-up message (b) reacts to a button click (c) sets colours and fonts (d) checks a quiz answer
  12. 12.✍️ What value is given to font-size in this rule?
    li {
      font-size: 20px;
      font-style: italic;
      margin: 10px;
      width: 300px;
    }
    (a) font-size (b) center (c) yellow (d) 20px
  13. 13.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 180px;
      justify-content: center;
    }
    Inside are 2 boxes, each 60px wide (no margins).
  14. 14.True or false: #hero is a class selector. (a) True (b) False
  15. 15.📦 In the box model, which part is space inside the border? (a) margin (b) content (c) padding (d) border
  16. 16.🌈 Which colour of light is strongest in rgb(77, 70, 170)? (a) blue (b) green (c) red
  17. 17.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 150px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 60px wide (no margins).
  18. 18.💪 Which justify-content value puts boxes in the middle? (a) space-between (b) flex-start (c) center (d) flex-end
  19. 19.🧩 Which language reacts to a button click? (a) CSS (b) JavaScript (c) HTML
  20. 20.🌈 Which colour is #0000ff? (a) yellow (b) white (c) blue (d) cyan
  21. 21.🖌️ Which CSS property sets the letter colour? (a) font-size (b) background-color (c) color (d) font-family
  22. 22.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 26px;
      }
    }
    (a) Yes (b) No
  23. 23.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 220px;
      justify-content: center;
    }
    Inside are 2 boxes, each 40px wide (no margins).
  24. 24.True or false: HTML puts a picture on a page. (a) False (b) True
  25. 25.🖌️ What colour is behind the letters?
    li {
      background-color: purple;
      color: white;
      font-size: 28px;
      text-align: left;
    }
    (a) purple (b) blue (c) white
  26. 26.🌈 Which colour is rgb(0, 255, 255)? (a) cyan (b) white (c) bright green (d) blue
  27. 27.🌈 Which colour is rgb(0, 0, 0)? (a) yellow (b) red (c) blue (d) black
  28. 28.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 110px;
      padding: 5px;
      border: 2px solid black;
      margin: 0px;
    }
  29. 29.📱 The screen is 820px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 22px;
      }
    }
    (a) Yes (b) No
  30. 30.What does background-color do? (a) picks the font style (b) makes letters bigger (c) makes the text bold (d) colours behind the text
  31. 31.✍️ How does a CSS comment start? (a) // (b) /* (c) # (d) <!--
  32. 32.🌈 Hex digits go 0 to 9, then A to which letter? (a) F (b) G (c) J (d) Z
  33. 33.Which of these does JavaScript do? (a) makes a form box (b) reacts to a button click (c) rounds box corners (d) adds space around boxes
  34. 34.⚖️ What colour is the text of this element?
    <p class="menu" id="top">Hi</p>
    CSS:
    .menu { color: blue; }
    .menu { color: red; }
    (a) white (b) blue (c) yellow (d) red
  35. 35.🧩 Which language makes a link? (a) JavaScript (b) CSS (c) HTML
  36. 36.🖌️ Where does the text sit on its line?
    h2 {
      background-color: green;
      color: yellow;
      font-size: 36px;
      text-align: center;
    }
    (a) in the middle (b) on the left (c) on the right
  37. 37.📦 In the box model, which part is the gap round content? (a) content (b) padding (c) margin (d) border
  38. 38.🎯 What kind of selector is h1? (a) a class selector (b) an id selector (c) an element selector
  39. 39.🧩 Which language makes headings and lists? (a) CSS (b) HTML (c) JavaScript
  40. 40.What does font-family do? (a) centres a heading (b) makes the text bold (c) colours behind the text (d) picks the font style

Answer key

  1. yellow
  2. center
  3. 2
  4. No
  5. font-family
  6. width
  7. blue
  8. an id selector
  9. font-weight
  10. 40
  11. sets colours and fonts
  12. 20px
  13. 30
  14. False
  15. padding
  16. blue
  17. 30
  18. center
  19. JavaScript
  20. blue
  21. color
  22. No
  23. 70
  24. True
  25. purple
  26. cyan
  27. black
  28. 124
  29. No
  30. colours behind the text
  31. /*
  32. F
  33. reacts to a button click
  34. red
  35. HTML
  36. in the middle
  37. padding
  38. an element selector
  39. HTML
  40. picks the font style

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