← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 325 · 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 CSS property makes the text bold? (a) color (b) background-color (c) text-align (d) font-weight
  2. 2.True or false: padding is space outside the border. (a) True (b) False
  3. 3.🎯 What kind of selector is #hero? (a) an element selector (b) an id selector (c) a class selector
  4. 4.What does font-family do? (a) sets the letter colour (b) centres a heading (c) picks the font style (d) makes letters bigger
  5. 5.🧩 Which language sets colours and fonts? (a) CSS (b) HTML (c) JavaScript
  6. 6.🎯 What kind of selector is .star? (a) an id selector (b) a class selector (c) an element selector
  7. 7.What does font-size do? (a) sets the letter colour (b) centres a heading (c) makes letters bigger (d) makes the text bold
  8. 8.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 8px;
      }
    }
  9. 9.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 22px;
      }
    }
  10. 10.What does justify-content: flex-start do? (a) packs boxes at the start (b) puts boxes in the middle (c) packs boxes at the end (d) equal gaps, none at ends
  11. 11.🔍 Which is the odd one out? (a) shows a pop-up message (b) puts a picture on a page (c) makes headings and lists (d) gives the page structure
  12. 12.🎨 A CSS file usually ends with which extension? (a) .js (b) .png (c) .css (d) .html
  13. 13.⚖️ What colour is the text of this element?
    <h2 class="star" id="main">Hi</h2>
    CSS:
    .star { color: yellow; }
    .star { color: red; }
    (a) yellow (b) black (c) purple (d) red
  14. 14.💪 Which flexbox property turns on flexbox? (a) flex-direction (b) gap (c) display: flex (d) align-items
  15. 15.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 28px;
      }
    }
  16. 16.Which of these does HTML do? (a) sets colours and fonts (b) reacts to a button click (c) puts a picture on a page (d) rounds box corners
  17. 17.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 230px;
      justify-content: space-between;
    }
    Inside are 2 boxes, each 80px wide (no margins).
  18. 18.✍️ What is the selector in this CSS rule?
    .note {
      text-align: center;
      padding: 8px;
    }
    (a) text-align (b) 8px (c) #top (d) .note
  19. 19.✍️ How many declarations (property: value pairs) are in this rule?
    #top {
      width: 300px;
    }
  20. 20.True or false: HTML reacts to a button click. (a) True (b) False
  21. 21.🎯 What kind of selector is .card? (a) an id selector (b) an element selector (c) a class selector
  22. 22.True or false: .star is an element selector. (a) False (b) True
  23. 23.✍️ Which property is set to 20px in this rule?
    body {
      font-size: 20px;
      color: red;
    }
    (a) text-align (b) 20px (c) font-size (d) background-color
  24. 24.⚖️ What colour is the text of this element?
    <h1 class="red" id="logo">Hi</h1>
    CSS:
    h1 { color: blue; }
    h1 { color: green; }
    (a) white (b) yellow (c) green (d) blue
  25. 25.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the later one (b) the shorter one (c) the first one (d) neither
  26. 26.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 40px;
      padding: 20px;
      border: 3px solid black;
      margin: 5px;
    }
  27. 27.✍️ What value is given to font-style in this rule?
    li {
      margin: 10px;
      font-weight: bold;
      font-style: italic;
    }
    (a) font-style (b) red (c) 20px (d) italic
  28. 28.✍️ What value is given to font-weight in this rule?
    p {
      font-size: 20px;
      font-weight: bold;
      text-align: center;
      padding: 8px;
    }
    (a) font-weight (b) 300px (c) bold (d) 2px solid
  29. 29.✍️ Which sign ends each CSS declaration? (a) : (b) ; (c) . (d) ,
  30. 30.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 290px;
      padding: 10px;
      border: 5px solid black;
      margin: 10px;
    }
  31. 31.⚖️ What colour is the text of this element?
    <h2 class="big" id="logo">Hi</h2>
    CSS:
    h2 { color: red; }
    h2 { color: orange; }
    (a) red (b) yellow (c) white (d) orange
  32. 32.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 70px;
      padding: 25px;
      border: 5px solid black;
      margin: 10px;
    }
  33. 33.✍️ Which property is set to yellow in this rule?
    body {
      color: red;
      background-color: yellow;
    }
    (a) yellow (b) margin (c) background-color (d) padding
  34. 34.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 18px;
      }
    }
  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: 70px;
      padding: 10px;
      border: 1px solid black;
      margin: 10px;
    }
  36. 36.✍️ How many declarations (property: value pairs) are in this rule?
    body {
      font-style: italic;
      padding: 8px;
      font-weight: bold;
    }
  37. 37.✍️ How does a CSS comment start? (a) // (b) <!-- (c) # (d) /*
  38. 38.What does font-weight do? (a) colours behind the text (b) makes letters bigger (c) picks the font style (d) makes the text bold
  39. 39.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 18px;
      }
    }
  40. 40.🌈 Which colour is rgb(255, 0, 0)? (a) red (b) cyan (c) blue (d) bright green

Answer key

  1. font-weight
  2. False
  3. an id selector
  4. picks the font style
  5. CSS
  6. a class selector
  7. makes letters bigger
  8. 8
  9. 22
  10. packs boxes at the start
  11. shows a pop-up message
  12. .css
  13. red
  14. display: flex
  15. 28
  16. puts a picture on a page
  17. 70
  18. .note
  19. 1
  20. False
  21. a class selector
  22. False
  23. font-size
  24. green
  25. the later one
  26. 96
  27. italic
  28. bold
  29. ;
  30. 340
  31. orange
  32. 150
  33. background-color
  34. 18
  35. 92
  36. 3
  37. /*
  38. makes the text bold
  39. 20
  40. red

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