← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 276 · 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.True or false: HTML changes the page live. (a) True (b) False
  2. 2.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 210px;
      justify-content: flex-end;
    }
    Inside are 2 boxes, each 100px wide (no margins).
  3. 3.🔍 Which is the odd one out? (a) lays out the page (b) reacts to a button click (c) sets colours and fonts (d) changes the text size
  4. 4.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 280px;
      justify-content: flex-end;
    }
    Inside are 4 boxes, each 60px wide (no margins).
  5. 5.✍️ Which property is set to 300px in this rule?
    h1 {
      width: 300px;
      border: 2px solid;
      color: red;
    }
    (a) 300px (b) width (c) font-style (d) color
  6. 6.🎯 Which CSS selector matches this element?
    <h1 class="note" id="end">Hello</h1>
    (a) #note (b) h1 (c) h2 (d) .big
  7. 7.🧩 Which language counts down a timer? (a) HTML (b) CSS (c) JavaScript
  8. 8.✍️ Which property is set to bold in this rule?
    h1 {
      font-weight: bold;
      color: red;
    }
    (a) width (b) border (c) font-weight (d) bold
  9. 9.True or false: HTML reacts to a button click. (a) False (b) True
  10. 10.⚖️ What colour is the text of this element?
    <p class="box" id="hero">Hi</p>
    CSS:
    .box { color: orange; }
    .box { color: red; }
    (a) green (b) red (c) orange (d) black
  11. 11.🖌️ What colour are the letters?
    h2 {
      background-color: red;
      font-size: 12px;
      color: white;
      text-align: left;
    }
    (a) blue (b) white (c) red
  12. 12.📱 The screen is 700px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 30px;
      }
    }
    (a) No (b) Yes
  13. 13.Which of these is the content? (a) space outside the border (b) a solid or dotted edge (c) the line round the box (d) the text or picture
  14. 14.⚖️ Which selector is the weakest? (a) an id selector (b) an element selector (c) a class selector
  15. 15.✍️ Which sign goes between a property and its value? (a) ; (b) : (c) = (d) -
  16. 16.What does justify-content: space-between do? (a) packs boxes at the end (b) puts boxes in the middle (c) packs boxes at the start (d) equal gaps, none at ends
  17. 17.🖌️ Where does the text sit on its line?
    h1 {
      text-align: right;
      color: purple;
      font-size: 12px;
      background-color: blue;
    }
    (a) in the middle (b) on the left (c) on the right
  18. 18.✍️ What is the selector in this CSS rule?
    h2 {
      width: 300px;
      margin: 10px;
      padding: 8px;
    }
    (a) 10px (b) h1 (c) h2 (d) width
  19. 19.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 110px;
      padding: 15px;
      border: 1px solid black;
      margin: 5px;
    }
  20. 20.Which of these does HTML do? (a) checks a quiz answer (b) puts a picture on a page (c) reacts to a button click (d) rounds box corners
  21. 21.🎯 What kind of selector is #top? (a) a class selector (b) an element selector (c) an id selector
  22. 22.🔍 Which is the odd one out? (a) makes a form box (b) checks a quiz answer (c) reacts to a button click (d) changes the page live
  23. 23.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 220px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 100px wide (no margins).
  24. 24.True or false: margin is the text or picture. (a) True (b) False
  25. 25.✍️ How many declarations (property: value pairs) are in this rule?
    h1 {
      background-color: yellow;
    }
  26. 26.⚖️ What colour is the text of this element?
    <h2 class="big" id="intro">Hi</h2>
    CSS:
    #intro { color: black; }
    #intro { color: orange; }
    (a) orange (b) black (c) blue (d) yellow
  27. 27.🌈 In #970000 the red part is the hex number 97. What is it as a normal number?
  28. 28.✍️ In color: blue; which part is the property? (a) color (b) ; (c) blue (d) :
  29. 29.📱 max-width: 600px applies when the screen is ___. (a) 600px or wider (b) turned off (c) 600px or narrower (d) exactly 1000px
  30. 30.🖌️ What colour is behind the letters?
    p {
      text-align: right;
      background-color: yellow;
      font-size: 32px;
      color: purple;
    }
    (a) yellow (b) green (c) purple
  31. 31.What does justify-content: flex-start do? (a) equal gaps, none at ends (b) packs boxes at the end (c) packs boxes at the start (d) puts boxes in the middle
  32. 32.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 300px;
      padding: 5px;
      border: 4px solid black;
      margin: 10px;
    }
  33. 33.🎯 Which CSS selector matches this element?
    <h1 class="note" id="logo">Hello</h1>
    (a) .logo (b) #logo (c) h2 (d) .big
  34. 34.⚖️ What colour is the text of this element?
    <h2 class="menu" id="hero">Hi</h2>
    CSS:
    #hero { color: yellow; }
    #hero { color: red; }
    (a) red (b) yellow (c) white (d) orange
  35. 35.What does justify-content: center do? (a) packs boxes at the end (b) puts boxes in the middle (c) packs boxes at the start (d) equal gaps, none at ends
  36. 36.True or false: the border is the text or picture. (a) True (b) False
  37. 37.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 160px;
      padding: 15px;
      border: 5px solid black;
      margin: 5px;
    }
  38. 38.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the later one (b) neither (c) the shorter one (d) the first one
  39. 39.🖌️ Which CSS property colours behind the text? (a) background-color (b) text-align (c) font-family (d) font-size
  40. 40.🎯 Which CSS selector matches this element?
    <li class="big" id="top">Hello</li>
    (a) .red (b) div (c) li (d) #big

Answer key

  1. False
  2. 10
  3. reacts to a button click
  4. 40
  5. width
  6. h1
  7. JavaScript
  8. font-weight
  9. False
  10. red
  11. white
  12. Yes
  13. the text or picture
  14. an element selector
  15. :
  16. equal gaps, none at ends
  17. on the right
  18. h2
  19. 152
  20. puts a picture on a page
  21. an id selector
  22. makes a form box
  23. 20
  24. False
  25. 1
  26. orange
  27. 151
  28. color
  29. 600px or narrower
  30. yellow
  31. packs boxes at the start
  32. 338
  33. #logo
  34. red
  35. puts boxes in the middle
  36. False
  37. 210
  38. the later one
  39. background-color
  40. li

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