← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 776 · 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 selector is the weakest? (a) an id selector (b) a class selector (c) an element selector
  2. 2.🖌️ Which CSS property sets the letter colour? (a) background-color (b) font-family (c) font-size (d) color
  3. 3.🌈 In #00d800 the green part is the hex number d8. What is it as a normal number?
  4. 4.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 28px;
      }
    }
  5. 5.Which of these is padding? (a) the line round the box (b) space inside the border (c) space outside the border (d) the text or picture
  6. 6.🌈 In #rrggbb, which colour do the first two digits give? (a) red (b) black (c) blue (d) green
  7. 7.🎯 How many elements on a page should have the same id? (a) 1 (b) 2 (c) 5 (d) any number
  8. 8.⚖️ What colour is the text of this element?
    <h2 class="menu" id="top">Hi</h2>
    CSS:
    #top { color: blue; }
    .menu { color: yellow; }
    (a) blue (b) white (c) purple (d) yellow
  9. 9.🎯 Which element does the selector #end style? (a) <div id="end"> (b) <div id="hero"> (c) <span class="note"> (d) <div class="end">
  10. 10.🖌️ How big is the text, in px?
    h1 {
      font-size: 16px;
      color: orange;
      text-align: center;
      background-color: purple;
    }
  11. 11.🎨 Which tag connects an outside CSS file? (a) <a> (b) <css> (c) <link> (d) <img>
  12. 12.🌈 What is the biggest number one colour can have in rgb()? (a) 1000 (b) 100 (c) 99 (d) 255
  13. 13.🎯 Which element does the selector #intro style? (a) <span class="intro"> (b) <span id="main"> (c) <p class="note"> (d) <span id="intro">
  14. 14.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 310px;
      justify-content: flex-end;
    }
    Inside are 4 boxes, each 60px wide (no margins).
  15. 15.🔍 Which is the odd one out? (a) makes a link (b) puts a picture on a page (c) makes headings and lists (d) changes the text size
  16. 16.🖌️ What colour are the letters?
    li {
      background-color: blue;
      font-size: 16px;
      text-align: center;
      color: white;
    }
    (a) white (b) green (c) blue
  17. 17.What does justify-content: space-between do? (a) equal gaps, none at ends (b) puts boxes in the middle (c) packs boxes at the start (d) packs boxes at the end
  18. 18.⚖️ Which selector is the strongest? (a) an element selector (b) an id selector (c) a class selector
  19. 19.🧩 Which language changes the page live? (a) CSS (b) JavaScript (c) HTML
  20. 20.🌈 In #c40000 the red part is the hex number c4. What is it as a normal number?
  21. 21.🎯 What kind of selector is li? (a) an id selector (b) a class selector (c) an element selector
  22. 22.🖌️ Which CSS property makes the text bold? (a) font-size (b) color (c) text-align (d) font-weight
  23. 23.True or false: .big is an id selector. (a) False (b) True
  24. 24.What does color do? (a) picks the font style (b) centres a heading (c) colours behind the text (d) sets the letter colour
  25. 25.True or false: CSS makes headings and lists. (a) False (b) True
  26. 26.🎯 Which sign starts an id selector? (a) . (b) @ (c) & (d) #
  27. 27.🌈 Which colour is #0000ff? (a) cyan (b) blue (c) white (d) magenta
  28. 28.✍️ What value is given to margin in this rule?
    h2 {
      margin: 10px;
      background-color: yellow;
      font-style: italic;
    }
    (a) bold (b) margin (c) 8px (d) 10px
  29. 29.⚖️ What colour is the text of this element?
    <h1 class="star" id="top">Hi</h1>
    CSS:
    h1 { color: black; }
    h1 { color: red; }
    (a) red (b) yellow (c) black (d) blue
  30. 30.⚖️ What colour is the text of this element?
    <h2 class="red" id="hero">Hi</h2>
    CSS:
    .red { color: orange; }
    .red { color: green; }
    (a) orange (b) red (c) purple (d) green
  31. 31.True or false: JavaScript shows a pop-up message. (a) True (b) False
  32. 32.What does font-family do? (a) makes letters bigger (b) picks the font style (c) sets the letter colour (d) makes the text bold
  33. 33.🖌️ How big is the text, in px?
    h2 {
      text-align: left;
      background-color: black;
      font-size: 16px;
      color: white;
    }
  34. 34.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 120px;
      padding: 30px;
      border: 2px solid black;
      margin: 15px;
    }
  35. 35.🎯 Which CSS selector matches this element?
    <li class="big" id="logo">Hello</li>
    (a) #end (b) .red (c) li (d) #big
  36. 36.✍️ What is the selector in this CSS rule?
    .note {
      border: 2px solid;
      padding: 8px;
      font-weight: bold;
    }
    (a) border (b) #top (c) 8px (d) .note
  37. 37.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 90px;
      padding: 5px;
      border: 2px solid black;
      margin: 10px;
    }
  38. 38.✍️ What is the selector in this CSS rule?
    h2 {
      font-style: italic;
      padding: 8px;
      font-weight: bold;
      margin: 10px;
    }
    (a) h2 (b) font-style (c) 8px (d) h1
  39. 39.💪 Which flexbox property spaces boxes along a row? (a) flex-direction (b) justify-content (c) display: flex (d) align-items
  40. 40.🌈 Which colour is #ff0000? (a) blue (b) bright green (c) red (d) magenta

Answer key

  1. an element selector
  2. color
  3. 216
  4. 24
  5. space inside the border
  6. red
  7. 1
  8. blue
  9. <div id="end">
  10. 16
  11. <link>
  12. 255
  13. <span id="intro">
  14. 70
  15. changes the text size
  16. white
  17. equal gaps, none at ends
  18. an id selector
  19. JavaScript
  20. 196
  21. an element selector
  22. font-weight
  23. False
  24. sets the letter colour
  25. False
  26. #
  27. blue
  28. 10px
  29. red
  30. green
  31. True
  32. picks the font style
  33. 16
  34. 214
  35. li
  36. .note
  37. 124
  38. h2
  39. justify-content
  40. red

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