← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 871 · 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.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 410px;
      justify-content: space-between;
    }
    Inside are 4 boxes, each 50px wide (no margins).
  2. 2.📱 Which tag helps phones show a page at the right size? (a) the br tag (b) the title tag (c) the viewport meta tag (d) the hr tag
  3. 3.🎯 Which CSS selector matches this element?
    <p class="box" id="logo">Hello</p>
    (a) .logo (b) p (c) #box (d) #end
  4. 4.🎯 Which element does the selector p style? (a) <p class="note"> (b) <h1> (c) <h2 class="note"> (d) <li id="logo">
  5. 5.🖌️ How big is the text, in px?
    h2 {
      text-align: left;
      background-color: yellow;
      font-size: 40px;
      color: white;
    }
  6. 6.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 270px;
      justify-content: flex-end;
    }
    Inside are 4 boxes, each 50px wide (no margins).
  7. 7.✍️ What value is given to font-style in this rule?
    .box {
      padding: 8px;
      border: 2px solid;
      font-style: italic;
      font-weight: bold;
    }
    (a) 20px (b) font-style (c) red (d) italic
  8. 8.True or false: #top is an id selector. (a) False (b) True
  9. 9.🌈 Which colour is #00ffff? (a) cyan (b) black (c) blue (d) white
  10. 10.📦 In the box model, which part is the line round the box? (a) margin (b) padding (c) border (d) content
  11. 11.✍️ How many declarations (property: value pairs) are in this rule?
    h1 {
      padding: 8px;
    }
  12. 12.⚖️ What colour is the text of this element?
    <h1 class="menu" id="intro">Hi</h1>
    CSS:
    h1 { color: green; }
    .menu { color: orange; }
    #intro { color: black; }
    (a) yellow (b) orange (c) black (d) green
  13. 13.Which of these does JavaScript do? (a) changes the text size (b) sets colours and fonts (c) checks a quiz answer (d) gives the page structure
  14. 14.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 60px;
      padding: 25px;
      border: 2px solid black;
      margin: 5px;
    }
  15. 15.🎨 A CSS file usually ends with which extension? (a) .png (b) .css (c) .js (d) .html
  16. 16.💪 Which flexbox property turns on flexbox? (a) justify-content (b) flex-direction (c) display: flex (d) gap
  17. 17.🎯 What kind of selector is .big? (a) a class selector (b) an id selector (c) an element selector
  18. 18.🎯 Which element does the selector #main style? (a) <div class="star"> (b) <li id="main"> (c) <li id="logo"> (d) <li class="main">
  19. 19.🖌️ What colour are the letters?
    h1 {
      background-color: white;
      color: blue;
      font-size: 36px;
      text-align: left;
    }
    (a) yellow (b) white (c) blue
  20. 20.🌈 Which hex code is black? (a) #ffff00 (b) #ffffff (c) #000000 (d) #0000ff
  21. 21.🎯 Which element does the selector li style? (a) <div> (b) <li class="note"> (c) <span class="note"> (d) <p id="main">
  22. 22.🎯 Can many elements share the same class? (a) Yes (b) No
  23. 23.Which of these does HTML do? (a) counts down a timer (b) shows a pop-up message (c) rounds box corners (d) gives the page structure
  24. 24.🎯 Which CSS selector matches this element?
    <p class="note" id="logo">Hello</p>
    (a) #note (b) h1 (c) .logo (d) .note
  25. 25.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 170px;
      padding: 10px;
      border: 1px solid black;
      margin: 5px;
    }
  26. 26.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 150px;
      padding: 20px;
      border: 3px solid black;
      margin: 0px;
    }
  27. 27.📱 The screen is 540px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 20px;
      }
    }
    (a) Yes (b) No
  28. 28.Which of these does CSS do? (a) changes the page live (b) counts down a timer (c) sets colours and fonts (d) puts a picture on a page
  29. 29.🌈 Which colour is rgb(0, 0, 0)? (a) red (b) cyan (c) bright green (d) black
  30. 30.✍️ How does a CSS comment start? (a) # (b) // (c) <!-- (d) /*
  31. 31.🌈 In #rrggbb, which colour do the last two digits give? (a) white (b) green (c) red (d) blue
  32. 32.🌈 Which hex code is red? (a) #00ff00 (b) #000000 (c) #ff0000 (d) #0000ff
  33. 33.What does justify-content: space-between do? (a) packs boxes at the start (b) equal gaps, none at ends (c) packs boxes at the end (d) puts boxes in the middle
  34. 34.⚖️ What colour is the text of this element?
    <p class="red" id="hero">Hi</p>
    CSS:
    #hero { color: red; }
    #hero { color: yellow; }
    (a) red (b) black (c) yellow (d) blue
  35. 35.🌈 Which colour of light is strongest in rgb(159, 62, 36)? (a) red (b) blue (c) green
  36. 36.✍️ How many declarations (property: value pairs) are in this rule?
    p {
      font-style: italic;
      font-size: 20px;
      border: 2px solid;
    }
  37. 37.Which of these is the border? (a) space outside the border (b) the line round the box (c) space inside the border (d) the gap round content
  38. 38.⚖️ What colour is the text of this element?
    <h1 class="big" id="hero">Hi</h1>
    CSS:
    h1 { color: white; }
    h1 { color: orange; }
    (a) white (b) orange (c) green (d) blue
  39. 39.What does justify-content: flex-start do? (a) packs boxes at the start (b) packs boxes at the end (c) equal gaps, none at ends (d) puts boxes in the middle
  40. 40.✍️ How many declarations (property: value pairs) are in this rule?
    li {
      font-size: 20px;
      width: 300px;
    }

Answer key

  1. 70
  2. the viewport meta tag
  3. p
  4. <p class="note">
  5. 40
  6. 70
  7. italic
  8. True
  9. cyan
  10. border
  11. 1
  12. black
  13. checks a quiz answer
  14. 124
  15. .css
  16. display: flex
  17. a class selector
  18. <li id="main">
  19. blue
  20. #000000
  21. <li class="note">
  22. Yes
  23. gives the page structure
  24. .note
  25. 202
  26. 196
  27. Yes
  28. sets colours and fonts
  29. black
  30. /*
  31. blue
  32. #ff0000
  33. equal gaps, none at ends
  34. yellow
  35. red
  36. 3
  37. the line round the box
  38. orange
  39. packs boxes at the start
  40. 2

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