← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 604 · 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 colour of light is strongest in rgb(218, 1, 32)? (a) green (b) blue (c) red
  2. 2.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 14px;
      }
    }
  3. 3.What does background-color do? (a) makes letters bigger (b) picks the font style (c) sets the letter colour (d) colours behind the text
  4. 4.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 4 (b) 6 (c) 2 (d) 3
  5. 5.✍️ Which property is set to 2px solid in this rule?
    .box {
      border: 2px solid;
      padding: 8px;
    }
    (a) width (b) 2px solid (c) font-style (d) border
  6. 6.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 14px;
      }
    }
  7. 7.✍️ How many declarations (property: value pairs) are in this rule?
    h2 {
      border: 2px solid;
      font-weight: bold;
    }
  8. 8.⚖️ What colour is the text of this element?
    <p class="note" id="main">Hi</p>
    CSS:
    p { color: yellow; }
    #main { color: white; }
    .note { color: purple; }
    (a) white (b) orange (c) yellow (d) purple
  9. 9.What does justify-content: space-between do? (a) puts boxes in the middle (b) packs boxes at the end (c) equal gaps, none at ends (d) packs boxes at the start
  10. 10.⚖️ What colour is the text of this element?
    <p class="box" id="end">Hi</p>
    CSS:
    #end { color: black; }
    p { color: blue; }
    (a) green (b) blue (c) black (d) purple
  11. 11.📦 In the box model, which part is the line round the box? (a) border (b) content (c) margin (d) padding
  12. 12.🖌️ Which CSS property sets the letter colour? (a) text-align (b) font-size (c) color (d) font-family
  13. 13.True or false: .star is a class selector. (a) False (b) True
  14. 14.🖌️ Where does the text sit on its line?
    h2 {
      background-color: green;
      color: yellow;
      font-size: 40px;
      text-align: right;
    }
    (a) on the left (b) on the right (c) in the middle
  15. 15.🌈 In #rrggbb, which colour do the first two digits give? (a) green (b) blue (c) black (d) red
  16. 16.🧩 Which language gives the page structure? (a) JavaScript (b) CSS (c) HTML
  17. 17.What does font-weight do? (a) makes the text bold (b) centres a heading (c) sets the letter colour (d) makes letters bigger
  18. 18.True or false: #end is an element selector. (a) True (b) False
  19. 19.⚖️ What colour is the text of this element?
    <p class="menu" id="logo">Hi</p>
    CSS:
    .menu { color: red; }
    #logo { color: purple; }
    p { color: green; }
    (a) purple (b) orange (c) green (d) red
  20. 20.🖌️ What colour is behind the letters?
    h1 {
      background-color: red;
      color: white;
      text-align: left;
      font-size: 24px;
    }
    (a) red (b) blue (c) white
  21. 21.True or false: .menu is an id selector. (a) True (b) False
  22. 22.🖌️ What colour are the letters?
    h2 {
      text-align: right;
      font-size: 24px;
      background-color: green;
      color: orange;
    }
    (a) green (b) orange (c) black
  23. 23.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 24px;
      }
    }
  24. 24.⚖️ What colour is the text of this element?
    <h1 class="big" id="hero">Hi</h1>
    CSS:
    h1 { color: black; }
    .big { color: orange; }
    (a) orange (b) red (c) black (d) green
  25. 25.🎯 Which CSS selector matches this element?
    <h1 class="note" id="logo">Hello</h1>
    (a) #end (b) h2 (c) .logo (d) h1
  26. 26.✍️ Which property is set to 8px in this rule?
    #top {
      padding: 8px;
      font-style: italic;
      width: 300px;
      font-size: 20px;
    }
    (a) border (b) padding (c) font-weight (d) 8px
  27. 27.🎨 What does CSS stand for? (a) Computer Style Sheets (b) Creative Sheet System (c) Cascading Style Sheets (d) Colourful Site Styles
  28. 28.True or false: padding is the text or picture. (a) False (b) True
  29. 29.💪 Which flexbox property spaces boxes along a row? (a) justify-content (b) display: flex (c) align-items (d) flex-direction
  30. 30.🖌️ How big is the text, in px?
    h1 {
      background-color: purple;
      text-align: left;
      color: yellow;
      font-size: 28px;
    }
  31. 31.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 60px;
      padding: 15px;
      border: 4px solid black;
      margin: 20px;
    }
  32. 32.🎯 Which CSS selector matches this element?
    <li class="menu" id="hero">Hello</li>
    (a) .note (b) div (c) .menu (d) .hero
  33. 33.⚖️ Which selector is the strongest? (a) an element selector (b) an id selector (c) a class selector
  34. 34.🖌️ Where does the text sit on its line?
    h2 {
      color: yellow;
      text-align: center;
      background-color: purple;
      font-size: 28px;
    }
    (a) on the right (b) in the middle (c) on the left
  35. 35.What does justify-content: flex-start do? (a) packs boxes at the start (b) packs boxes at the end (c) puts boxes in the middle (d) equal gaps, none at ends
  36. 36.✍️ Which sign goes between a property and its value? (a) = (b) - (c) ; (d) :
  37. 37.🎯 Which element does the selector p style? (a) <h2 class="red"> (b) <p class="red"> (c) <h1> (d) <li id="main">
  38. 38.⚖️ What colour is the text of this element?
    <h2 class="menu" id="top">Hi</h2>
    CSS:
    h2 { color: yellow; }
    .menu { color: purple; }
    #top { color: white; }
    (a) white (b) black (c) purple (d) yellow
  39. 39.🖌️ How big is the text, in px?
    h1 {
      font-size: 28px;
      text-align: center;
      background-color: orange;
      color: white;
    }
  40. 40.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 140px;
      padding: 25px;
      border: 2px solid black;
      margin: 0px;
    }

Answer key

  1. red
  2. 14
  3. colours behind the text
  4. 3
  5. border
  6. 14
  7. 2
  8. white
  9. equal gaps, none at ends
  10. black
  11. border
  12. color
  13. True
  14. on the right
  15. red
  16. HTML
  17. makes the text bold
  18. False
  19. purple
  20. red
  21. False
  22. orange
  23. 20
  24. orange
  25. h1
  26. padding
  27. Cascading Style Sheets
  28. False
  29. justify-content
  30. 28
  31. 138
  32. .menu
  33. an id selector
  34. in the middle
  35. packs boxes at the start
  36. :
  37. <p class="red">
  38. white
  39. 28
  40. 194

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