← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 792 · 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 much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 140px;
      justify-content: flex-end;
    }
    Inside are 3 boxes, each 40px wide (no margins).
  2. 2.🌈 In #003800 the green part is the hex number 38. What is it as a normal number?
  3. 3.🖌️ How big is the text, in px?
    li {
      text-align: left;
      font-size: 16px;
      background-color: purple;
      color: orange;
    }
  4. 4.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 270px;
      justify-content: flex-end;
    }
    Inside are 3 boxes, each 80px wide (no margins).
  5. 5.🖌️ Which CSS property sets the letter colour? (a) font-weight (b) color (c) background-color (d) font-family
  6. 6.🌈 Which colour is rgb(0, 255, 0)? (a) white (b) yellow (c) bright green (d) cyan
  7. 7.🎯 Which element does the selector h1 style? (a) <li class="box"> (b) <h1 class="box"> (c) <h2> (d) <div id="end">
  8. 8.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 270px;
      padding: 5px;
      border: 3px solid black;
      margin: 10px;
    }
  9. 9.True or false: HTML gives the page structure. (a) False (b) True
  10. 10.What does text-align do? (a) picks the font style (b) makes the text bold (c) makes letters bigger (d) centres a heading
  11. 11.Which of these does CSS do? (a) reacts to a button click (b) makes headings and lists (c) counts down a timer (d) rounds box corners
  12. 12.What does font-weight do? (a) makes letters bigger (b) makes the text bold (c) sets the letter colour (d) colours behind the text
  13. 13.True or false: HTML counts down a timer. (a) False (b) True
  14. 14.✍️ What value is given to background-color in this rule?
    body {
      font-size: 20px;
      background-color: yellow;
    }
    (a) 8px (b) background-color (c) 10px (d) yellow
  15. 15.🎯 Which element does the selector .box style? (a) <h2 class="star"> (b) <h2 class="box"> (c) <li class="menu"> (d) <h2 id="box">
  16. 16.⚖️ What colour is the text of this element?
    <p class="big" id="hero">Hi</p>
    CSS:
    .big { color: green; }
    .big { color: white; }
    (a) yellow (b) white (c) orange (d) green
  17. 17.📱 max-width: 600px applies when the screen is ___. (a) exactly 1000px (b) 600px or narrower (c) turned off (d) 600px or wider
  18. 18.💪 Which justify-content value puts boxes in the middle? (a) center (b) flex-end (c) flex-start (d) space-between
  19. 19.🎯 Which element does the selector span style? (a) <p> (b) <h2 id="hero"> (c) <h1 class="menu"> (d) <span class="menu">
  20. 20.📱 What does a media query check? (a) the battery level (b) the screen width (c) the time of day (d) the page title
  21. 21.✍️ Which sign ends each CSS declaration? (a) : (b) , (c) . (d) ;
  22. 22.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 2 (b) 6 (c) 4 (d) 3
  23. 23.🖌️ Where does the text sit on its line?
    h1 {
      background-color: black;
      color: white;
      font-size: 20px;
      text-align: left;
    }
    (a) in the middle (b) on the right (c) on the left
  24. 24.🖌️ Which CSS property centres a heading? (a) text-align (b) background-color (c) font-weight (d) font-size
  25. 25.🎯 What kind of selector is p? (a) an id selector (b) an element selector (c) a class selector
  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: 240px;
      padding: 10px;
      border: 1px solid black;
      margin: 5px;
    }
  27. 27.Which of these is padding? (a) the gap to other boxes (b) space outside the border (c) a solid or dotted edge (d) the gap round content
  28. 28.🎯 What kind of selector is .card? (a) an id selector (b) an element selector (c) a class selector
  29. 29.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 140px;
      justify-content: flex-end;
    }
    Inside are 2 boxes, each 40px wide (no margins).
  30. 30.🖌️ Which CSS property picks the font style? (a) color (b) text-align (c) font-family (d) font-size
  31. 31.🌈 Which colour is rgb(0, 0, 0)? (a) red (b) black (c) blue (d) white
  32. 32.🌈 Which colour is #000000? (a) black (b) blue (c) bright green (d) yellow
  33. 33.🖌️ How big is the text, in px?
    h1 {
      font-size: 32px;
      text-align: right;
      background-color: red;
      color: white;
    }
  34. 34.🌈 In #rrggbb, which colour do the first two digits give? (a) blue (b) black (c) green (d) red
  35. 35.🎨 Which tag connects an outside CSS file? (a) <css> (b) <a> (c) <img> (d) <link>
  36. 36.✍️ Which property is set to 2px solid in this rule?
    h2 {
      text-align: center;
      border: 2px solid;
    }
    (a) 2px solid (b) font-style (c) width (d) border
  37. 37.🖌️ What colour are the letters?
    h1 {
      background-color: green;
      font-size: 28px;
      text-align: right;
      color: black;
    }
    (a) black (b) green (c) orange
  38. 38.⚖️ What colour is the text of this element?
    <p class="big" id="end">Hi</p>
    CSS:
    p { color: yellow; }
    #end { color: black; }
    (a) purple (b) blue (c) black (d) yellow
  39. 39.🖌️ What colour are the letters?
    li {
      background-color: green;
      font-size: 32px;
      color: blue;
      text-align: right;
    }
    (a) green (b) yellow (c) blue
  40. 40.True or false: the border is the gap round content. (a) True (b) False

Answer key

  1. 20
  2. 56
  3. 16
  4. 30
  5. color
  6. bright green
  7. <h1 class="box">
  8. 286
  9. True
  10. centres a heading
  11. rounds box corners
  12. makes the text bold
  13. False
  14. yellow
  15. <h2 class="box">
  16. white
  17. 600px or narrower
  18. center
  19. <span class="menu">
  20. the screen width
  21. ;
  22. 3
  23. on the left
  24. text-align
  25. an element selector
  26. 262
  27. the gap round content
  28. a class selector
  29. 60
  30. font-family
  31. black
  32. black
  33. 32
  34. red
  35. <link>
  36. border
  37. black
  38. black
  39. blue
  40. False

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