← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 769 · 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 colours behind the text? (a) color (b) font-weight (c) font-size (d) background-color
  2. 2.🌈 Which colour of light is strongest in rgb(77, 125, 175)? (a) red (b) green (c) blue
  3. 3.💪 Which flexbox property lines boxes up across? (a) display: flex (b) align-items (c) justify-content (d) flex-direction
  4. 4.What does font-family do? (a) sets the letter colour (b) makes the text bold (c) picks the font style (d) centres a heading
  5. 5.🎯 How many elements on a page should have the same id? (a) any number (b) 1 (c) 2 (d) 5
  6. 6.💪 Which flexbox property spaces boxes along a row? (a) flex-direction (b) justify-content (c) display: flex (d) gap
  7. 7.🖌️ Which CSS property centres a heading? (a) color (b) background-color (c) font-size (d) text-align
  8. 8.✍️ Which property is set to 300px in this rule?
    p {
      width: 300px;
      margin: 10px;
    }
    (a) width (b) 300px (c) font-style (d) color
  9. 9.🌈 Which colour of light is strongest in rgb(52, 107, 247)? (a) red (b) blue (c) green
  10. 10.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 10px;
      }
    }
  11. 11.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 230px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 100px wide (no margins).
  12. 12.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 80px;
      padding: 10px;
      border: 4px solid black;
      margin: 10px;
    }
  13. 13.✍️ How does a CSS comment start? (a) /* (b) <!-- (c) // (d) #
  14. 14.🎯 Which CSS selector matches this element?
    <h2 class="box" id="top">Hello</h2>
    (a) .star (b) #box (c) .box (d) #intro
  15. 15.🔍 Which is the odd one out? (a) shows a pop-up message (b) makes a link (c) reacts to a button click (d) counts down a timer
  16. 16.✍️ Which property is set to 10px in this rule?
    #top {
      width: 300px;
      font-weight: bold;
      margin: 10px;
    }
    (a) margin (b) font-weight (c) padding (d) 10px
  17. 17.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 10px;
      }
    }
  18. 18.🎯 Which CSS selector matches this element?
    <p class="star" id="top">Hello</p>
    (a) #star (b) .menu (c) .star (d) h1
  19. 19.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 390px;
      justify-content: flex-start;
    }
    Inside are 4 boxes, each 80px wide (no margins).
  20. 20.🖌️ Which CSS property makes letters bigger? (a) color (b) font-size (c) background-color (d) text-align
  21. 21.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 270px;
      justify-content: space-between;
    }
    Inside are 4 boxes, each 60px wide (no margins).
  22. 22.📦 In the box model, which part is the gap round content? (a) padding (b) margin (c) content (d) border
  23. 23.📦 In the box model, which part is the line round the box? (a) content (b) border (c) margin (d) padding
  24. 24.True or false: img is a class selector. (a) True (b) False
  25. 25.📦 In the box model, which part is a solid or dotted edge? (a) margin (b) border (c) padding (d) content
  26. 26.🎯 What kind of selector is .card? (a) an id selector (b) an element selector (c) a class selector
  27. 27.🔍 Which is the odd one out? (a) makes a form box (b) gives the page structure (c) lays out the page (d) makes headings and lists
  28. 28.✍️ Which property is set to yellow in this rule?
    h1 {
      background-color: yellow;
      font-size: 20px;
    }
    (a) margin (b) yellow (c) padding (d) background-color
  29. 29.✍️ How many declarations (property: value pairs) are in this rule?
    body {
      font-size: 20px;
    }
  30. 30.🎯 Which element does the selector span style? (a) <h1 class="box"> (b) <h2 id="hero"> (c) <p> (d) <span class="box">
  31. 31.🌈 Which colour of light is strongest in rgb(75, 170, 126)? (a) blue (b) green (c) red
  32. 32.🎯 Which sign starts a class selector? (a) # (b) @ (c) . (d) &
  33. 33.🧩 Which language counts down a timer? (a) CSS (b) JavaScript (c) HTML
  34. 34.⚖️ What colour is the text of this element?
    <p class="menu" id="intro">Hi</p>
    CSS:
    #intro { color: blue; }
    #intro { color: purple; }
    (a) green (b) white (c) blue (d) purple
  35. 35.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 210px;
      justify-content: flex-start;
    }
    Inside are 4 boxes, each 50px wide (no margins).
  36. 36.🌈 Which hex code is cyan? (a) #000000 (b) #00ffff (c) #ffff00 (d) #ff00ff
  37. 37.🧩 Which language changes the text size? (a) JavaScript (b) CSS (c) HTML
  38. 38.🎯 What kind of selector is h1? (a) an id selector (b) a class selector (c) an element selector
  39. 39.🖌️ Which CSS property sets the letter colour? (a) font-weight (b) text-align (c) color (d) font-size
  40. 40.✍️ What value is given to text-align in this rule?
    h2 {
      text-align: center;
      color: red;
      font-weight: bold;
    }
    (a) yellow (b) center (c) text-align (d) 10px

Answer key

  1. background-color
  2. blue
  3. align-items
  4. picks the font style
  5. 1
  6. justify-content
  7. text-align
  8. width
  9. blue
  10. 12
  11. 30
  12. 128
  13. /*
  14. .box
  15. makes a link
  16. margin
  17. 10
  18. .star
  19. 70
  20. font-size
  21. 10
  22. padding
  23. border
  24. False
  25. border
  26. a class selector
  27. lays out the page
  28. background-color
  29. 1
  30. <span class="box">
  31. green
  32. .
  33. JavaScript
  34. purple
  35. 10
  36. #00ffff
  37. CSS
  38. an element selector
  39. color
  40. center

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