← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 851 · 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 left after the last box?
    .row {
      display: flex;
      width: 230px;
      justify-content: flex-start;
    }
    Inside are 4 boxes, each 40px wide (no margins).
  2. 2.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 290px;
      padding: 10px;
      border: 1px solid black;
      margin: 20px;
    }
  3. 3.💪 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 80px wide (no margins).
  4. 4.📦 In the box model, which part is space outside the border? (a) padding (b) border (c) margin (d) content
  5. 5.🎯 Which CSS selector matches this element?
    <li class="box" id="hero">Hello</li>
    (a) #box (b) #top (c) div (d) li
  6. 6.✍️ Which property is set to red in this rule?
    .note {
      border: 2px solid;
      width: 300px;
      padding: 8px;
      color: red;
    }
    (a) red (b) font-size (c) color (d) text-align
  7. 7.🌈 In #0000ed the blue part is the hex number ed. What is it as a normal number?
  8. 8.✍️ How many declarations (property: value pairs) are in this rule?
    li {
      background-color: yellow;
      text-align: center;
    }
  9. 9.Which of these is the border? (a) the gap to other boxes (b) the line round the box (c) space outside the border (d) the gap round content
  10. 10.🖌️ What colour is behind the letters?
    h2 {
      font-size: 28px;
      text-align: center;
      background-color: orange;
      color: green;
    }
    (a) purple (b) green (c) orange
  11. 11.🎯 Which sign starts an id selector? (a) @ (b) # (c) & (d) .
  12. 12.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 50px;
      padding: 15px;
      border: 5px solid black;
      margin: 15px;
    }
  13. 13.📱 The screen is 1100px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 8px;
      }
    }
    (a) No (b) Yes
  14. 14.🌈 In #0000e2 the blue part is the hex number e2. What is it as a normal number?
  15. 15.📦 In the box model, which part is the line round the box? (a) content (b) margin (c) padding (d) border
  16. 16.📦 In the box model, which part is the gap round content? (a) margin (b) border (c) content (d) padding
  17. 17.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 220px;
      justify-content: space-between;
    }
    Inside are 3 boxes, each 40px wide (no margins).
  18. 18.True or false: padding is space outside the border. (a) False (b) True
  19. 19.⚖️ What colour is the text of this element?
    <p class="note" id="hero">Hi</p>
    CSS:
    .note { color: red; }
    .note { color: orange; }
    (a) red (b) black (c) orange (d) yellow
  20. 20.True or false: the border is a solid or dotted edge. (a) False (b) True
  21. 21.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 180px;
      padding: 25px;
      border: 2px solid black;
      margin: 10px;
    }
  22. 22.🌈 Which colour is #0000ff? (a) red (b) yellow (c) blue (d) magenta
  23. 23.True or false: CSS gives the page structure. (a) True (b) False
  24. 24.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 250px;
      padding: 15px;
      border: 4px solid black;
      margin: 20px;
    }
  25. 25.⚖️ Which selector is the strongest? (a) an id selector (b) an element selector (c) a class selector
  26. 26.🌈 Which colour is #ffffff? (a) yellow (b) red (c) cyan (d) white
  27. 27.💪 Which justify-content value puts boxes in the middle? (a) flex-start (b) flex-end (c) space-between (d) center
  28. 28.🖌️ Which CSS property makes the text bold? (a) background-color (b) color (c) font-weight (d) font-family
  29. 29.⚖️ What colour is the text of this element?
    <h1 class="red" id="top">Hi</h1>
    CSS:
    .red { color: red; }
    .red { color: purple; }
    (a) purple (b) yellow (c) red (d) green
  30. 30.True or false: margin is the gap to other boxes. (a) True (b) False
  31. 31.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 270px;
      padding: 20px;
      border: 3px solid black;
      margin: 5px;
    }
  32. 32.What does font-family do? (a) centres a heading (b) makes letters bigger (c) colours behind the text (d) picks the font style
  33. 33.🎯 Which element does the selector h2 style? (a) <li> (b) <h2 class="box"> (c) <span id="main"> (d) <div class="box">
  34. 34.✍️ How does a CSS comment start? (a) // (b) # (c) /* (d) <!--
  35. 35.🌈 In #00e100 the green part is the hex number e1. What is it as a normal number?
  36. 36.🔍 Which is the odd one out? (a) reacts to a button click (b) puts a picture on a page (c) shows a pop-up message (d) changes the page live
  37. 37.✍️ How many declarations (property: value pairs) are in this rule?
    body {
      width: 300px;
      font-weight: bold;
      font-style: italic;
    }
  38. 38.True or false: JavaScript counts down a timer. (a) True (b) False
  39. 39.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 6px;
      }
    }
  40. 40.🌈 In #rrggbb, which colour do the first two digits give? (a) green (b) blue (c) red (d) black

Answer key

  1. 70
  2. 352
  3. 60
  4. margin
  5. li
  6. color
  7. 237
  8. 2
  9. the line round the box
  10. orange
  11. #
  12. 120
  13. No
  14. 226
  15. border
  16. padding
  17. 50
  18. False
  19. orange
  20. True
  21. 254
  22. blue
  23. False
  24. 328
  25. an id selector
  26. white
  27. center
  28. font-weight
  29. purple
  30. True
  31. 326
  32. picks the font style
  33. <h2 class="box">
  34. /*
  35. 225
  36. puts a picture on a page
  37. 3
  38. True
  39. 12
  40. red

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