← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 912 · 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.🌈 In #060000 the red part is the hex number 06. What is it as a normal number?
  2. 2.True or false: #hero is an id selector. (a) True (b) False
  3. 3.⚖️ Two rules with the same selector set a colour. Which one wins? (a) neither (b) the later one (c) the first one (d) the shorter one
  4. 4.Which of these is the content? (a) the text or picture (b) a solid or dotted edge (c) the gap round content (d) the line round the box
  5. 5.📱 The screen is 540px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 26px;
      }
    }
    (a) Yes (b) No
  6. 6.🧩 Which language reacts to a button click? (a) JavaScript (b) HTML (c) CSS
  7. 7.🔍 Which is the odd one out? (a) adds space around boxes (b) changes the text size (c) lays out the page (d) puts a picture on a page
  8. 8.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 400px;
      justify-content: space-between;
    }
    Inside are 4 boxes, each 40px wide (no margins).
  9. 9.⚖️ What colour is the text of this element?
    <h2 class="star" id="top">Hi</h2>
    CSS:
    .star { color: purple; }
    .star { color: blue; }
    (a) purple (b) blue (c) yellow (d) orange
  10. 10.📦 In the box model, which part is space outside the border? (a) margin (b) content (c) border (d) padding
  11. 11.🎯 What kind of selector is #hero? (a) an id selector (b) a class selector (c) an element selector
  12. 12.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 80px;
      padding: 20px;
      border: 5px solid black;
      margin: 10px;
    }
  13. 13.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 360px;
      justify-content: center;
    }
    Inside are 2 boxes, each 100px wide (no margins).
  14. 14.What does background-color do? (a) colours behind the text (b) picks the font style (c) centres a heading (d) makes the text bold
  15. 15.🌈 Which colour is rgb(255, 0, 255)? (a) magenta (b) red (c) cyan (d) bright green
  16. 16.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 24px;
      }
    }
  17. 17.🎯 Which CSS selector matches this element?
    <div class="menu" id="end">Hello</div>
    (a) .note (b) #end (c) #menu (d) #hero
  18. 18.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 10px;
      }
    }
  19. 19.🖌️ What colour is behind the letters?
    h1 {
      color: orange;
      background-color: black;
      text-align: left;
      font-size: 12px;
    }
    (a) black (b) orange (c) blue
  20. 20.✍️ What is the selector in this CSS rule?
    body {
      text-align: center;
      font-size: 20px;
      border: 2px solid;
      margin: 10px;
    }
    (a) .box (b) body (c) 20px (d) text-align
  21. 21.🌈 Which colour of light is strongest in rgb(237, 28, 13)? (a) blue (b) red (c) green
  22. 22.🌈 Which colour of light is strongest in rgb(238, 60, 98)? (a) green (b) blue (c) red
  23. 23.True or false: margin is the text or picture. (a) False (b) True
  24. 24.True or false: the border is a solid or dotted edge. (a) True (b) False
  25. 25.Which of these does CSS do? (a) makes headings and lists (b) gives the page structure (c) puts a picture on a page (d) lays out the page
  26. 26.🎯 Which CSS selector matches this element?
    <span class="box" id="hero">Hello</span>
    (a) .star (b) #top (c) #box (d) .box
  27. 27.🔍 Which is the odd one out? (a) reacts to a button click (b) makes headings and lists (c) puts a picture on a page (d) makes a link
  28. 28.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 160px;
      padding: 15px;
      border: 5px solid black;
      margin: 15px;
    }
  29. 29.🌈 Which colour is #ff00ff? (a) cyan (b) magenta (c) red (d) blue
  30. 30.⚖️ What colour is the text of this element?
    <p class="note" id="intro">Hi</p>
    CSS:
    #intro { color: blue; }
    .note { color: yellow; }
    (a) yellow (b) red (c) green (d) blue
  31. 31.🖌️ Which CSS property sets the letter colour? (a) font-weight (b) text-align (c) color (d) font-family
  32. 32.What does color do? (a) picks the font style (b) centres a heading (c) sets the letter colour (d) colours behind the text
  33. 33.⚖️ Which selector is the weakest? (a) a class selector (b) an element selector (c) an id selector
  34. 34.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 70px;
      padding: 15px;
      border: 3px solid black;
      margin: 15px;
    }
  35. 35.What does font-family do? (a) centres a heading (b) sets the letter colour (c) makes the text bold (d) picks the font style
  36. 36.✍️ Which property is set to 10px in this rule?
    .note {
      text-align: center;
      color: red;
      margin: 10px;
      font-style: italic;
    }
    (a) padding (b) font-weight (c) margin (d) 10px
  37. 37.Which of these does JavaScript do? (a) gives the page structure (b) makes a link (c) adds space around boxes (d) checks a quiz answer
  38. 38.🎯 What kind of selector is p? (a) an id selector (b) an element selector (c) a class selector
  39. 39.Which of these is the border? (a) space inside the border (b) the gap round content (c) the text or picture (d) a solid or dotted edge
  40. 40.🌈 Which colour is #ffffff? (a) blue (b) magenta (c) white (d) red

Answer key

  1. 6
  2. True
  3. the later one
  4. the text or picture
  5. No
  6. JavaScript
  7. puts a picture on a page
  8. 80
  9. blue
  10. margin
  11. an id selector
  12. 150
  13. 80
  14. colours behind the text
  15. magenta
  16. 24
  17. #end
  18. 10
  19. black
  20. body
  21. red
  22. red
  23. False
  24. True
  25. lays out the page
  26. .box
  27. reacts to a button click
  28. 230
  29. magenta
  30. blue
  31. color
  32. sets the letter colour
  33. an element selector
  34. 136
  35. picks the font style
  36. margin
  37. checks a quiz answer
  38. an element selector
  39. a solid or dotted edge
  40. white

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