← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 466 · 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.🌈 In #bb0000 the red part is the hex number bb. What is it as a normal number?
  2. 2.🎯 Which element does the selector #main style? (a) <li id="main"> (b) <div class="red"> (c) <li class="main"> (d) <li id="logo">
  3. 3.🖌️ Which CSS property picks the font style? (a) font-size (b) color (c) font-family (d) font-weight
  4. 4.🌈 Which colour is rgb(0, 255, 255)? (a) cyan (b) magenta (c) bright green (d) white
  5. 5.📦 In the box model, which part is a solid or dotted edge? (a) padding (b) margin (c) border (d) content
  6. 6.📱 The screen is 1100px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 16px;
      }
    }
    (a) No (b) Yes
  7. 7.⚖️ What colour is the text of this element?
    <h1 class="star" id="top">Hi</h1>
    CSS:
    #top { color: orange; }
    h1 { color: blue; }
    .star { color: green; }
    (a) orange (b) green (c) blue (d) purple
  8. 8.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 14px;
      }
    }
    (a) No (b) Yes
  9. 9.✍️ What value is given to padding in this rule?
    li {
      font-size: 20px;
      padding: 8px;
      text-align: center;
    }
    (a) 2px solid (b) bold (c) padding (d) 8px
  10. 10.What does justify-content: flex-end do? (a) puts boxes in the middle (b) packs boxes at the start (c) packs boxes at the end (d) equal gaps, none at ends
  11. 11.🌈 In #410000 the red part is the hex number 41. What is it as a normal number?
  12. 12.🎯 Which CSS selector matches this element?
    <div class="big" id="hero">Hello</div>
    (a) #top (b) div (c) .hero (d) #big
  13. 13.⚖️ Which selector is the weakest? (a) an element selector (b) an id selector (c) a class selector
  14. 14.✍️ What value is given to text-align in this rule?
    body {
      font-weight: bold;
      text-align: center;
    }
    (a) center (b) text-align (c) 10px (d) yellow
  15. 15.True or false: HTML makes a link. (a) False (b) True
  16. 16.✍️ Which property is set to 2px solid in this rule?
    p {
      font-weight: bold;
      border: 2px solid;
      padding: 8px;
      font-style: italic;
    }
    (a) 2px solid (b) width (c) border (d) font-style
  17. 17.⚖️ What colour is the text of this element?
    <p class="red" id="end">Hi</p>
    CSS:
    #end { color: blue; }
    p { color: orange; }
    .red { color: yellow; }
    (a) yellow (b) orange (c) blue (d) green
  18. 18.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 22px;
      }
    }
  19. 19.✍️ What value is given to width in this rule?
    h1 {
      width: 300px;
      border: 2px solid;
    }
    (a) red (b) italic (c) 300px (d) width
  20. 20.✍️ How many declarations (property: value pairs) are in this rule?
    .note {
      font-size: 20px;
      padding: 8px;
      text-align: center;
      font-style: italic;
    }
  21. 21.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 270px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 100px wide (no margins).
  22. 22.🌈 Which colour is #000000? (a) yellow (b) white (c) bright green (d) black
  23. 23.✍️ What value is given to text-align in this rule?
    #top {
      text-align: center;
      font-weight: bold;
      font-style: italic;
    }
    (a) 10px (b) text-align (c) yellow (d) center
  24. 24.📦 In the box model, which part is space outside the border? (a) border (b) padding (c) content (d) margin
  25. 25.✍️ Which property is set to 10px in this rule?
    .note {
      background-color: yellow;
      margin: 10px;
    }
    (a) margin (b) padding (c) 10px (d) font-weight
  26. 26.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 16px;
      }
    }
  27. 27.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the shorter one (b) the first one (c) the later one (d) neither
  28. 28.What does font-size do? (a) makes letters bigger (b) sets the letter colour (c) makes the text bold (d) colours behind the text
  29. 29.⚖️ What colour is the text of this element?
    <p class="star" id="intro">Hi</p>
    CSS:
    #intro { color: yellow; }
    #intro { color: red; }
    (a) green (b) purple (c) yellow (d) red
  30. 30.True or false: CSS reacts to a button click. (a) True (b) False
  31. 31.True or false: padding is a solid or dotted edge. (a) True (b) False
  32. 32.✍️ What value is given to font-size in this rule?
    h2 {
      font-size: 20px;
      font-style: italic;
    }
    (a) font-size (b) center (c) 20px (d) yellow
  33. 33.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 6px;
      }
    }
  34. 34.What does justify-content: flex-start do? (a) puts boxes in the middle (b) packs boxes at the end (c) packs boxes at the start (d) equal gaps, none at ends
  35. 35.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 18px;
      }
    }
  36. 36.✍️ What value is given to color in this rule?
    p {
      color: red;
      font-size: 20px;
    }
    (a) center (b) 20px (c) color (d) red
  37. 37.🎯 What kind of selector is #top? (a) an id selector (b) an element selector (c) a class selector
  38. 38.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 290px;
      padding: 10px;
      border: 2px solid black;
      margin: 0px;
    }
  39. 39.🌈 Which colour is rgb(255, 0, 0)? (a) cyan (b) yellow (c) bright green (d) red
  40. 40.🖌️ What colour are the letters?
    h2 {
      color: blue;
      text-align: left;
      background-color: red;
      font-size: 12px;
    }
    (a) orange (b) blue (c) red

Answer key

  1. 187
  2. <li id="main">
  3. font-family
  4. cyan
  5. border
  6. Yes
  7. orange
  8. Yes
  9. 8px
  10. packs boxes at the end
  11. 65
  12. div
  13. an element selector
  14. center
  15. True
  16. border
  17. blue
  18. 24
  19. 300px
  20. 4
  21. 70
  22. black
  23. center
  24. margin
  25. margin
  26. 16
  27. the later one
  28. makes letters bigger
  29. red
  30. False
  31. False
  32. 20px
  33. 6
  34. packs boxes at the start
  35. 12
  36. red
  37. an id selector
  38. 314
  39. red
  40. blue

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