← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 351 · 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.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 240px;
      justify-content: flex-end;
    }
    Inside are 4 boxes, each 50px wide (no margins).
  2. 2.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 14px;
      }
    }
    (a) No (b) Yes
  3. 3.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 18px;
      }
    }
  4. 4.🎨 A CSS file usually ends with which extension? (a) .html (b) .css (c) .js (d) .png
  5. 5.📱 The screen is 540px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 16px;
      }
    }
    (a) Yes (b) No
  6. 6.What does font-size do? (a) makes letters bigger (b) sets the letter colour (c) picks the font style (d) makes the text bold
  7. 7.🌈 Which hex code is blue? (a) #ffff00 (b) #ff00ff (c) #ff0000 (d) #0000ff
  8. 8.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 16px;
      }
    }
  9. 9.⚖️ What colour is the text of this element?
    <h2 class="star" id="top">Hi</h2>
    CSS:
    #top { color: orange; }
    h2 { color: green; }
    (a) red (b) white (c) orange (d) green
  10. 10.🖌️ Which CSS property makes letters bigger? (a) font-size (b) text-align (c) font-family (d) color
  11. 11.True or false: padding is the gap to other boxes. (a) False (b) True
  12. 12.🎯 Which sign starts a class selector? (a) @ (b) . (c) # (d) &
  13. 13.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 18px;
      }
    }
  14. 14.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 6px;
      }
    }
  15. 15.True or false: body is an element selector. (a) True (b) False
  16. 16.What does justify-content: center do? (a) packs boxes at the end (b) puts boxes in the middle (c) packs boxes at the start (d) equal gaps, none at ends
  17. 17.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 120px;
      justify-content: center;
    }
    Inside are 2 boxes, each 40px wide (no margins).
  18. 18.What does justify-content: space-between do? (a) packs boxes at the start (b) equal gaps, none at ends (c) packs boxes at the end (d) puts boxes in the middle
  19. 19.🖌️ Which CSS property sets the letter colour? (a) text-align (b) font-weight (c) font-family (d) color
  20. 20.🖌️ Which CSS property picks the font style? (a) font-family (b) text-align (c) background-color (d) color
  21. 21.🔍 Which is the odd one out? (a) makes headings and lists (b) rounds box corners (c) puts a picture on a page (d) gives the page structure
  22. 22.🎯 Which element does the selector .star style? (a) <h2 class="star"> (b) <h2 id="star"> (c) <h2 class="menu"> (d) <li class="note">
  23. 23.⚖️ What colour is the text of this element?
    <h2 class="big" id="main">Hi</h2>
    CSS:
    #main { color: yellow; }
    .big { color: green; }
    (a) green (b) yellow (c) white (d) black
  24. 24.✍️ What value is given to font-weight in this rule?
    p {
      font-size: 20px;
      font-weight: bold;
    }
    (a) font-weight (b) 300px (c) 2px solid (d) bold
  25. 25.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 70px;
      padding: 30px;
      border: 1px solid black;
      margin: 0px;
    }
  26. 26.⚖️ What colour is the text of this element?
    <p class="menu" id="intro">Hi</p>
    CSS:
    #intro { color: yellow; }
    #intro { color: purple; }
    (a) purple (b) yellow (c) blue (d) green
  27. 27.📦 In the box model, which part is a solid or dotted edge? (a) content (b) margin (c) padding (d) border
  28. 28.📱 The screen is 414px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 18px;
      }
    }
    (a) No (b) Yes
  29. 29.🖌️ How big is the text, in px?
    li {
      font-size: 32px;
      background-color: yellow;
      text-align: left;
      color: red;
    }
  30. 30.🖌️ Where does the text sit on its line?
    p {
      background-color: green;
      font-size: 40px;
      text-align: right;
      color: yellow;
    }
    (a) on the left (b) in the middle (c) on the right
  31. 31.✍️ Which property is set to red in this rule?
    body {
      margin: 10px;
      padding: 8px;
      width: 300px;
      color: red;
    }
    (a) text-align (b) font-size (c) red (d) color
  32. 32.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the first one (b) the shorter one (c) the later one (d) neither
  33. 33.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 8px;
      }
    }
    (a) Yes (b) No
  34. 34.🌈 Hex digits go 0 to 9, then A to which letter? (a) Z (b) F (c) J (d) G
  35. 35.🎯 Can many elements share the same class? (a) No (b) Yes
  36. 36.✍️ In color: blue; which part is the property? (a) ; (b) color (c) : (d) blue
  37. 37.🎯 Which CSS selector matches this element?
    <span class="box" id="intro">Hello</span>
    (a) .star (b) .box (c) .intro (d) #box
  38. 38.✍️ Which sign goes between a property and its value? (a) - (b) = (c) ; (d) :
  39. 39.✍️ How many declarations (property: value pairs) are in this rule?
    h1 {
      width: 300px;
      text-align: center;
    }
  40. 40.✍️ Which property is set to center in this rule?
    #top {
      font-size: 20px;
      text-align: center;
    }
    (a) margin (b) background-color (c) center (d) text-align

Answer key

  1. 40
  2. No
  3. 18
  4. .css
  5. Yes
  6. makes letters bigger
  7. #0000ff
  8. 12
  9. orange
  10. font-size
  11. False
  12. .
  13. 18
  14. 6
  15. True
  16. puts boxes in the middle
  17. 20
  18. equal gaps, none at ends
  19. color
  20. font-family
  21. rounds box corners
  22. <h2 class="star">
  23. yellow
  24. bold
  25. 132
  26. purple
  27. border
  28. Yes
  29. 32
  30. on the right
  31. color
  32. the later one
  33. Yes
  34. F
  35. Yes
  36. color
  37. .box
  38. :
  39. 2
  40. text-align

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