← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 30 · 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 many declarations (property: value pairs) are in this rule?
    h2 {
      font-size: 20px;
      background-color: yellow;
      text-align: center;
      margin: 10px;
    }
  2. 2.True or false: JavaScript checks a quiz answer. (a) True (b) False
  3. 3.✍️ How many declarations (property: value pairs) are in this rule?
    .note {
      color: red;
    }
  4. 4.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 14px;
      }
    }
  5. 5.✍️ How does a CSS comment start? (a) # (b) <!-- (c) // (d) /*
  6. 6.🌈 Which colour is rgb(0, 255, 0)? (a) yellow (b) bright green (c) red (d) magenta
  7. 7.🔍 Which is the odd one out? (a) gives the page structure (b) puts a picture on a page (c) makes headings and lists (d) sets colours and fonts
  8. 8.What does font-weight do? (a) makes the text bold (b) colours behind the text (c) sets the letter colour (d) makes letters bigger
  9. 9.✍️ Which property is set to 2px solid in this rule?
    h2 {
      background-color: yellow;
      font-style: italic;
      border: 2px solid;
      text-align: center;
    }
    (a) width (b) font-style (c) 2px solid (d) border
  10. 10.🖌️ What colour is behind the letters?
    h1 {
      background-color: red;
      color: black;
      text-align: right;
      font-size: 32px;
    }
    (a) black (b) red (c) yellow
  11. 11.🖌️ Which CSS property makes letters bigger? (a) text-align (b) font-size (c) font-family (d) font-weight
  12. 12.True or false: margin is space inside the border. (a) True (b) False
  13. 13.What does justify-content: flex-start do? (a) equal gaps, none at ends (b) puts boxes in the middle (c) packs boxes at the end (d) packs boxes at the start
  14. 14.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 220px;
      justify-content: flex-start;
    }
    Inside are 4 boxes, each 40px wide (no margins).
  15. 15.✍️ How many declarations (property: value pairs) are in this rule?
    #top {
      font-size: 20px;
    }
  16. 16.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 10px;
      }
    }
  17. 17.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 18px;
      }
    }
  18. 18.✍️ What value is given to background-color in this rule?
    .note {
      text-align: center;
      background-color: yellow;
      font-size: 20px;
    }
    (a) background-color (b) 8px (c) yellow (d) 10px
  19. 19.⚖️ What colour is the text of this element?
    <p class="box" id="end">Hi</p>
    CSS:
    p { color: white; }
    p { color: blue; }
    (a) white (b) black (c) red (d) blue
  20. 20.✍️ What value is given to font-style in this rule?
    .note {
      width: 300px;
      font-style: italic;
      margin: 10px;
      font-weight: bold;
    }
    (a) red (b) 20px (c) italic (d) font-style
  21. 21.True or false: .star is an element selector. (a) False (b) True
  22. 22.True or false: JavaScript puts a picture on a page. (a) False (b) True
  23. 23.🧩 Which language makes headings and lists? (a) JavaScript (b) HTML (c) CSS
  24. 24.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 190px;
      padding: 25px;
      border: 1px solid black;
      margin: 5px;
    }
  25. 25.🖌️ Which CSS property makes the text bold? (a) font-family (b) font-weight (c) text-align (d) background-color
  26. 26.Which of these does CSS do? (a) changes the page live (b) checks a quiz answer (c) rounds box corners (d) puts a picture on a page
  27. 27.🖌️ Which CSS property colours behind the text? (a) background-color (b) font-weight (c) font-family (d) font-size
  28. 28.🔍 Which is the odd one out? (a) changes the text size (b) rounds box corners (c) adds space around boxes (d) makes headings and lists
  29. 29.🎯 Which CSS selector matches this element?
    <div class="star" id="top">Hello</div>
    (a) #star (b) #intro (c) .top (d) div
  30. 30.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 160px;
      justify-content: flex-end;
    }
    Inside are 2 boxes, each 50px wide (no margins).
  31. 31.🎯 Which sign starts a class selector? (a) @ (b) & (c) # (d) .
  32. 32.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the shorter one (b) neither (c) the later one (d) the first one
  33. 33.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 280px;
      justify-content: flex-end;
    }
    Inside are 2 boxes, each 100px wide (no margins).
  34. 34.✍️ How many declarations (property: value pairs) are in this rule?
    h2 {
      padding: 8px;
      font-size: 20px;
    }
  35. 35.⚖️ What colour is the text of this element?
    <h1 class="red" id="top">Hi</h1>
    CSS:
    .red { color: orange; }
    .red { color: green; }
    (a) black (b) orange (c) green (d) red
  36. 36.⚖️ What colour is the text of this element?
    <p class="box" id="intro">Hi</p>
    CSS:
    .box { color: green; }
    p { color: blue; }
    (a) blue (b) white (c) green (d) red
  37. 37.Which of these does HTML do? (a) shows a pop-up message (b) changes the text size (c) reacts to a button click (d) puts a picture on a page
  38. 38.🌈 In #rrggbb, which colour do the first two digits give? (a) red (b) black (c) blue (d) green
  39. 39.⚖️ What colour is the text of this element?
    <h2 class="red" id="end">Hi</h2>
    CSS:
    h2 { color: yellow; }
    #end { color: black; }
    (a) purple (b) orange (c) yellow (d) black
  40. 40.Which of these does HTML do? (a) changes the page live (b) counts down a timer (c) changes the text size (d) makes headings and lists

Answer key

  1. 4
  2. True
  3. 1
  4. 20
  5. /*
  6. bright green
  7. sets colours and fonts
  8. makes the text bold
  9. border
  10. red
  11. font-size
  12. False
  13. packs boxes at the start
  14. 60
  15. 1
  16. 12
  17. 20
  18. yellow
  19. blue
  20. italic
  21. False
  22. False
  23. HTML
  24. 252
  25. font-weight
  26. rounds box corners
  27. background-color
  28. makes headings and lists
  29. div
  30. 60
  31. .
  32. the later one
  33. 80
  34. 2
  35. green
  36. green
  37. puts a picture on a page
  38. red
  39. black
  40. makes headings and lists

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