← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 829 · 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 is the odd one out? (a) reacts to a button click (b) makes a form box (c) makes headings and lists (d) makes a link
  2. 2.✍️ In color: blue; which part is the property? (a) : (b) blue (c) ; (d) color
  3. 3.🖌️ Which CSS property sets the letter colour? (a) font-weight (b) font-family (c) font-size (d) color
  4. 4.🖌️ Which CSS property centres a heading? (a) font-family (b) text-align (c) font-weight (d) color
  5. 5.🎯 Can many elements share the same class? (a) Yes (b) No
  6. 6.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 8px;
      }
    }
  7. 7.🖌️ How big is the text, in px?
    h1 {
      font-size: 12px;
      text-align: left;
      background-color: purple;
      color: blue;
    }
  8. 8.Which of these does CSS do? (a) sets colours and fonts (b) gives the page structure (c) changes the page live (d) reacts to a button click
  9. 9.⚖️ Which selector is the strongest? (a) an element selector (b) a class selector (c) an id selector
  10. 10.⚖️ What colour is the text of this element?
    <p class="big" id="hero">Hi</p>
    CSS:
    p { color: red; }
    .big { color: blue; }
    #hero { color: green; }
    (a) blue (b) green (c) yellow (d) red
  11. 11.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 10px;
      }
    }
    (a) Yes (b) No
  12. 12.✍️ CSS declarations go inside which brackets? (a) < > (b) [ ] (c) ( ) (d) { }
  13. 13.⚖️ What colour is the text of this element?
    <h1 class="big" id="main">Hi</h1>
    CSS:
    #main { color: blue; }
    #main { color: white; }
    (a) white (b) black (c) blue (d) purple
  14. 14.✍️ Which property is set to 2px solid in this rule?
    .box {
      font-weight: bold;
      border: 2px solid;
    }
    (a) border (b) font-style (c) 2px solid (d) width
  15. 15.📱 Responsive design means a page ___. (a) never changes (b) has no pictures (c) is only for laptops (d) fits every screen
  16. 16.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 22px;
      }
    }
  17. 17.What does justify-content: flex-end do? (a) packs boxes at the start (b) packs boxes at the end (c) equal gaps, none at ends (d) puts boxes in the middle
  18. 18.✍️ Which property is set to center in this rule?
    h2 {
      margin: 10px;
      font-size: 20px;
      text-align: center;
    }
    (a) center (b) margin (c) background-color (d) text-align
  19. 19.🎨 Which attribute adds CSS inside one tag? (a) alt (b) src (c) href (d) style
  20. 20.✍️ Which property is set to 20px in this rule?
    #top {
      font-style: italic;
      font-weight: bold;
      font-size: 20px;
    }
    (a) text-align (b) 20px (c) background-color (d) font-size
  21. 21.🖌️ Which CSS property colours behind the text? (a) color (b) font-family (c) text-align (d) background-color
  22. 22.✍️ How many declarations (property: value pairs) are in this rule?
    body {
      color: red;
      font-size: 20px;
      width: 300px;
      border: 2px solid;
    }
  23. 23.🖌️ Where does the text sit on its line?
    li {
      font-size: 16px;
      text-align: right;
      color: black;
      background-color: yellow;
    }
    (a) on the right (b) in the middle (c) on the left
  24. 24.🌈 Which hex code is cyan? (a) #00ffff (b) #000000 (c) #ff00ff (d) #ff0000
  25. 25.What does font-size do? (a) makes letters bigger (b) sets the letter colour (c) colours behind the text (d) centres a heading
  26. 26.🌈 In #rrggbb, which colour do the first two digits give? (a) blue (b) black (c) green (d) red
  27. 27.📱 The screen is 540px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 12px;
      }
    }
    (a) No (b) Yes
  28. 28.🖌️ Which CSS property makes the text bold? (a) font-weight (b) font-family (c) text-align (d) color
  29. 29.🖌️ Which CSS property picks the font style? (a) color (b) font-weight (c) font-family (d) background-color
  30. 30.True or false: .card is an element selector. (a) False (b) True
  31. 31.🌈 In #00000e the blue part is the hex number 0e. What is it as a normal number?
  32. 32.⚖️ What colour is the text of this element?
    <p class="box" id="intro">Hi</p>
    CSS:
    p { color: white; }
    p { color: orange; }
    (a) white (b) green (c) black (d) orange
  33. 33.🖌️ What colour are the letters?
    h1 {
      color: black;
      font-size: 24px;
      background-color: orange;
      text-align: center;
    }
    (a) yellow (b) black (c) orange
  34. 34.True or false: CSS makes a link. (a) False (b) True
  35. 35.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 50px;
      padding: 25px;
      border: 4px solid black;
      margin: 0px;
    }
  36. 36.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 560px;
      justify-content: center;
    }
    Inside are 4 boxes, each 100px wide (no margins).
  37. 37.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 100px;
      padding: 10px;
      border: 2px solid black;
      margin: 0px;
    }
  38. 38.🌈 Which hex code is magenta? (a) #00ffff (b) #ff00ff (c) #0000ff (d) #ff0000
  39. 39.🌈 Which colour is #000000? (a) white (b) cyan (c) black (d) bright green
  40. 40.🌈 Which colour is rgb(255, 0, 0)? (a) magenta (b) black (c) blue (d) red

Answer key

  1. reacts to a button click
  2. color
  3. color
  4. text-align
  5. Yes
  6. 8
  7. 12
  8. sets colours and fonts
  9. an id selector
  10. green
  11. Yes
  12. { }
  13. white
  14. border
  15. fits every screen
  16. 22
  17. packs boxes at the end
  18. text-align
  19. style
  20. font-size
  21. background-color
  22. 4
  23. on the right
  24. #00ffff
  25. makes letters bigger
  26. red
  27. No
  28. font-weight
  29. font-family
  30. False
  31. 14
  32. orange
  33. black
  34. False
  35. 108
  36. 80
  37. 124
  38. #ff00ff
  39. black
  40. red

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