← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 369 · 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 property is set to 10px in this rule?
    body {
      width: 300px;
      margin: 10px;
      padding: 8px;
      font-style: italic;
    }
    (a) 10px (b) padding (c) font-weight (d) margin
  2. 2.⚖️ What colour is the text of this element?
    <h1 class="note" id="end">Hi</h1>
    CSS:
    h1 { color: orange; }
    .note { color: black; }
    #end { color: purple; }
    (a) red (b) purple (c) black (d) orange
  3. 3.🎨 Which attribute adds CSS inside one tag? (a) style (b) alt (c) src (d) href
  4. 4.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 160px;
      justify-content: flex-start;
    }
    Inside are 3 boxes, each 50px wide (no margins).
  5. 5.🖌️ What colour are the letters?
    h2 {
      text-align: center;
      font-size: 40px;
      background-color: black;
      color: blue;
    }
    (a) black (b) orange (c) blue
  6. 6.⚖️ What colour is the text of this element?
    <h1 class="box" id="logo">Hi</h1>
    CSS:
    #logo { color: white; }
    #logo { color: orange; }
    (a) green (b) white (c) purple (d) orange
  7. 7.🌈 Which colour of light is strongest in rgb(91, 162, 9)? (a) red (b) blue (c) green
  8. 8.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 12px;
      }
    }
  9. 9.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 180px;
      padding: 20px;
      border: 5px solid black;
      margin: 20px;
    }
  10. 10.Which of these does JavaScript do? (a) adds space around boxes (b) makes a link (c) reacts to a button click (d) changes the text size
  11. 11.✍️ How many declarations (property: value pairs) are in this rule?
    p {
      font-size: 20px;
    }
  12. 12.🌈 Which colour is #ffffff? (a) red (b) white (c) blue (d) bright green
  13. 13.🌈 In #001000 the green part is the hex number 10. What is it as a normal number?
  14. 14.What does font-size do? (a) makes letters bigger (b) makes the text bold (c) colours behind the text (d) picks the font style
  15. 15.📦 In the box model, which part is the gap to other boxes? (a) content (b) margin (c) padding (d) border
  16. 16.🎯 What kind of selector is .star? (a) an id selector (b) an element selector (c) a class selector
  17. 17.🖌️ How big is the text, in px?
    h1 {
      color: blue;
      font-size: 28px;
      background-color: green;
      text-align: left;
    }
  18. 18.🖌️ What colour is behind the letters?
    p {
      text-align: left;
      background-color: yellow;
      color: blue;
      font-size: 24px;
    }
    (a) red (b) yellow (c) blue
  19. 19.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 220px;
      padding: 25px;
      border: 3px solid black;
      margin: 10px;
    }
  20. 20.🌈 Which colour is rgb(255, 0, 0)? (a) blue (b) bright green (c) red (d) magenta
  21. 21.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 220px;
      justify-content: center;
    }
    Inside are 2 boxes, each 40px wide (no margins).
  22. 22.⚖️ What colour is the text of this element?
    <h1 class="big" id="intro">Hi</h1>
    CSS:
    h1 { color: yellow; }
    h1 { color: blue; }
    (a) green (b) blue (c) yellow (d) black
  23. 23.🖌️ Which CSS property colours behind the text? (a) font-size (b) color (c) background-color (d) font-weight
  24. 24.🖌️ What colour are the letters?
    h1 {
      font-size: 32px;
      background-color: black;
      text-align: right;
      color: green;
    }
    (a) black (b) white (c) green
  25. 25.🖌️ What colour is behind the letters?
    p {
      text-align: center;
      background-color: white;
      color: red;
      font-size: 20px;
    }
    (a) white (b) red (c) purple
  26. 26.What does font-weight do? (a) makes the text bold (b) picks the font style (c) centres a heading (d) sets the letter colour
  27. 27.💪 Which flexbox property picks row or column? (a) display: flex (b) flex-direction (c) gap (d) justify-content
  28. 28.✍️ Which sign ends each CSS declaration? (a) , (b) : (c) . (d) ;
  29. 29.💪 Which justify-content value packs boxes at the start? (a) flex-start (b) flex-end (c) space-between (d) center
  30. 30.🌈 What is the biggest number one colour can have in rgb()? (a) 99 (b) 100 (c) 1000 (d) 255
  31. 31.🌈 Which hex code is white? (a) #ffffff (b) #0000ff (c) #ffff00 (d) #ff0000
  32. 32.🎯 Which sign starts an id selector? (a) # (b) @ (c) . (d) &
  33. 33.🎯 Which CSS selector matches this element?
    <h2 class="big" id="main">Hello</h2>
    (a) .red (b) .big (c) li (d) #big
  34. 34.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 26px;
      }
    }
  35. 35.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 110px;
      padding: 10px;
      border: 2px solid black;
      margin: 0px;
    }
  36. 36.🧩 Which language lays out the page? (a) CSS (b) JavaScript (c) HTML
  37. 37.✍️ Which property is set to red in this rule?
    .box {
      margin: 10px;
      border: 2px solid;
      width: 300px;
      color: red;
    }
    (a) color (b) font-size (c) text-align (d) red
  38. 38.⚖️ Which selector is the strongest? (a) a class selector (b) an element selector (c) an id selector
  39. 39.🖌️ How big is the text, in px?
    li {
      text-align: left;
      font-size: 40px;
      color: orange;
      background-color: yellow;
    }
  40. 40.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the first one (b) the later one (c) the shorter one (d) neither

Answer key

  1. margin
  2. purple
  3. style
  4. 10
  5. blue
  6. orange
  7. green
  8. 12
  9. 270
  10. reacts to a button click
  11. 1
  12. white
  13. 16
  14. makes letters bigger
  15. margin
  16. a class selector
  17. 28
  18. yellow
  19. 276
  20. red
  21. 70
  22. blue
  23. background-color
  24. green
  25. white
  26. makes the text bold
  27. flex-direction
  28. ;
  29. flex-start
  30. 255
  31. #ffffff
  32. #
  33. .big
  34. 24
  35. 134
  36. CSS
  37. color
  38. an id selector
  39. 40
  40. the later one

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