← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 611 · 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 #000063 the blue part is the hex number 63. What is it as a normal number?
  2. 2.✍️ Which property is set to center in this rule?
    .box {
      margin: 10px;
      border: 2px solid;
      color: red;
      text-align: center;
    }
    (a) margin (b) text-align (c) background-color (d) center
  3. 3.🎯 Which element does the selector .note style? (a) <li class="big"> (b) <li id="note"> (c) <li class="note"> (d) <div class="red">
  4. 4.🌈 In #ac0000 the red part is the hex number ac. What is it as a normal number?
  5. 5.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 230px;
      justify-content: space-between;
    }
    Inside are 3 boxes, each 50px wide (no margins).
  6. 6.✍️ In color: blue; which part is the value? (a) blue (b) : (c) ; (d) color
  7. 7.🎯 Which element does the selector #main style? (a) <li id="logo"> (b) <li id="main"> (c) <li class="main"> (d) <div class="big">
  8. 8.✍️ Which property is set to 10px in this rule?
    li {
      margin: 10px;
      border: 2px solid;
    }
    (a) margin (b) font-weight (c) 10px (d) padding
  9. 9.🎨 Which attribute adds CSS inside one tag? (a) href (b) src (c) style (d) alt
  10. 10.🎯 Which sign starts a class selector? (a) . (b) @ (c) # (d) &
  11. 11.🧩 Which language counts down a timer? (a) HTML (b) CSS (c) JavaScript
  12. 12.🌈 Which colour is rgb(0, 0, 255)? (a) blue (b) magenta (c) red (d) bright green
  13. 13.🌈 Which colour is rgb(255, 0, 0)? (a) red (b) blue (c) magenta (d) white
  14. 14.True or false: CSS changes the page live. (a) True (b) False
  15. 15.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 180px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 80px wide (no margins).
  16. 16.⚖️ What colour is the text of this element?
    <h2 class="note" id="end">Hi</h2>
    CSS:
    h2 { color: red; }
    h2 { color: blue; }
    (a) orange (b) red (c) white (d) blue
  17. 17.🧩 Which language lays out the page? (a) HTML (b) CSS (c) JavaScript
  18. 18.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 90px;
      padding: 5px;
      border: 2px solid black;
      margin: 20px;
    }
  19. 19.🖌️ Where does the text sit on its line?
    h1 {
      background-color: orange;
      text-align: center;
      font-size: 24px;
      color: yellow;
    }
    (a) on the left (b) on the right (c) in the middle
  20. 20.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 120px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 50px wide (no margins).
  21. 21.Which of these does JavaScript do? (a) lays out the page (b) makes a form box (c) changes the text size (d) shows a pop-up message
  22. 22.✍️ In color: blue; which part is the property? (a) color (b) ; (c) : (d) blue
  23. 23.📦 In the box model, which part is the line round the box? (a) content (b) padding (c) border (d) margin
  24. 24.🖌️ Which CSS property makes letters bigger? (a) text-align (b) font-family (c) font-size (d) font-weight
  25. 25.🔍 Which is the odd one out? (a) checks a quiz answer (b) reacts to a button click (c) shows a pop-up message (d) gives the page structure
  26. 26.⚖️ Which selector is the strongest? (a) an element selector (b) a class selector (c) an id selector
  27. 27.🎯 What kind of selector is #logo? (a) an id selector (b) a class selector (c) an element selector
  28. 28.⚖️ What colour is the text of this element?
    <p class="red" id="hero">Hi</p>
    CSS:
    .red { color: yellow; }
    p { color: purple; }
    (a) red (b) white (c) yellow (d) purple
  29. 29.🖌️ Where does the text sit on its line?
    h1 {
      color: black;
      background-color: red;
      font-size: 36px;
      text-align: right;
    }
    (a) on the right (b) on the left (c) in the middle
  30. 30.📱 What does a media query check? (a) the page title (b) the screen width (c) the time of day (d) the battery level
  31. 31.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 6 (b) 4 (c) 3 (d) 2
  32. 32.True or false: the border is the gap round content. (a) False (b) True
  33. 33.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 260px;
      justify-content: flex-start;
    }
    Inside are 4 boxes, each 50px wide (no margins).
  34. 34.🖌️ What colour is behind the letters?
    h2 {
      color: purple;
      background-color: yellow;
      text-align: left;
      font-size: 36px;
    }
    (a) black (b) purple (c) yellow
  35. 35.🌈 Hex digits go 0 to 9, then A to which letter? (a) Z (b) F (c) G (d) J
  36. 36.✍️ How many declarations (property: value pairs) are in this rule?
    p {
      font-weight: bold;
      font-style: italic;
      text-align: center;
      margin: 10px;
    }
  37. 37.🖌️ Where does the text sit on its line?
    h1 {
      background-color: white;
      color: green;
      font-size: 20px;
      text-align: right;
    }
    (a) on the left (b) on the right (c) in the middle
  38. 38.💪 Which justify-content value equal gaps, none at ends? (a) flex-end (b) center (c) flex-start (d) space-between
  39. 39.⚖️ What colour is the text of this element?
    <h2 class="star" id="top">Hi</h2>
    CSS:
    #top { color: green; }
    #top { color: yellow; }
    (a) green (b) black (c) yellow (d) blue
  40. 40.🎯 Which element does the selector li style? (a) <div> (b) <li class="box"> (c) <span class="box"> (d) <p id="main">

Answer key

  1. 99
  2. text-align
  3. <li class="note">
  4. 172
  5. 40
  6. blue
  7. <li id="main">
  8. margin
  9. style
  10. .
  11. JavaScript
  12. blue
  13. red
  14. False
  15. 20
  16. blue
  17. CSS
  18. 144
  19. in the middle
  20. 20
  21. shows a pop-up message
  22. color
  23. border
  24. font-size
  25. gives the page structure
  26. an id selector
  27. an id selector
  28. yellow
  29. on the right
  30. the screen width
  31. 3
  32. False
  33. 60
  34. yellow
  35. F
  36. 4
  37. on the right
  38. space-between
  39. yellow
  40. <li class="box">

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