← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 519 · 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.🔍 Which is the odd one out? (a) adds space around boxes (b) lays out the page (c) reacts to a button click (d) rounds box corners
  2. 2.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 24px;
      }
    }
  3. 3.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 260px;
      padding: 5px;
      border: 2px solid black;
      margin: 10px;
    }
  4. 4.✍️ What is the selector in this CSS rule?
    h1 {
      border: 2px solid;
      padding: 8px;
      font-size: 20px;
      text-align: center;
    }
    (a) h1 (b) p (c) border (d) 8px
  5. 5.🖌️ What colour is behind the letters?
    li {
      background-color: white;
      text-align: right;
      font-size: 16px;
      color: black;
    }
    (a) red (b) white (c) black
  6. 6.True or false: #hero is an id selector. (a) False (b) True
  7. 7.🌈 In #00005e the blue part is the hex number 5e. What is it as a normal number?
  8. 8.⚖️ What colour is the text of this element?
    <h1 class="note" id="logo">Hi</h1>
    CSS:
    .note { color: orange; }
    .note { color: red; }
    (a) red (b) orange (c) yellow (d) white
  9. 9.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 190px;
      justify-content: space-between;
    }
    Inside are 2 boxes, each 80px wide (no margins).
  10. 10.True or false: JavaScript reacts to a button click. (a) False (b) True
  11. 11.🌈 What is the biggest number one colour can have in rgb()? (a) 99 (b) 1000 (c) 100 (d) 255
  12. 12.⚖️ What colour is the text of this element?
    <h1 class="star" id="main">Hi</h1>
    CSS:
    .star { color: blue; }
    .star { color: purple; }
    (a) black (b) purple (c) white (d) blue
  13. 13.Which of these is margin? (a) a solid or dotted edge (b) the line round the box (c) the gap to other boxes (d) space inside the border
  14. 14.🔍 Which is the odd one out? (a) makes a link (b) makes a form box (c) lays out the page (d) puts a picture on a page
  15. 15.✍️ How many declarations (property: value pairs) are in this rule?
    p {
      border: 2px solid;
      font-style: italic;
      padding: 8px;
      color: red;
    }
  16. 16.What does background-color do? (a) makes the text bold (b) colours behind the text (c) makes letters bigger (d) centres a heading
  17. 17.What does justify-content: flex-start do? (a) puts boxes in the middle (b) equal gaps, none at ends (c) packs boxes at the start (d) packs boxes at the end
  18. 18.True or false: margin is the gap round content. (a) False (b) True
  19. 19.✍️ What value is given to border in this rule?
    #top {
      border: 2px solid;
      padding: 8px;
    }
    (a) italic (b) border (c) 300px (d) 2px solid
  20. 20.⚖️ Which selector is the strongest? (a) an element selector (b) a class selector (c) an id selector
  21. 21.✍️ Which property is set to 2px solid in this rule?
    #top {
      width: 300px;
      border: 2px solid;
    }
    (a) 2px solid (b) width (c) border (d) font-style
  22. 22.⚖️ What colour is the text of this element?
    <h2 class="box" id="main">Hi</h2>
    CSS:
    #main { color: white; }
    #main { color: purple; }
    (a) black (b) white (c) purple (d) orange
  23. 23.🌈 In #002400 the green part is the hex number 24. What is it as a normal number?
  24. 24.True or false: padding is space inside the border. (a) False (b) True
  25. 25.✍️ How many declarations (property: value pairs) are in this rule?
    .box {
      text-align: center;
      color: red;
      font-weight: bold;
    }
  26. 26.🔍 Which is the odd one out? (a) gives the page structure (b) makes headings and lists (c) makes a link (d) shows a pop-up message
  27. 27.📱 Responsive design means a page ___. (a) is only for laptops (b) has no pictures (c) fits every screen (d) never changes
  28. 28.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 120px;
      justify-content: space-between;
    }
    Inside are 2 boxes, each 40px wide (no margins).
  29. 29.True or false: HTML rounds box corners. (a) False (b) True
  30. 30.🖌️ How big is the text, in px?
    h2 {
      background-color: blue;
      text-align: left;
      font-size: 28px;
      color: yellow;
    }
  31. 31.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 12px;
      }
    }
  32. 32.True or false: padding is a solid or dotted edge. (a) False (b) True
  33. 33.✍️ How many declarations (property: value pairs) are in this rule?
    h2 {
      background-color: yellow;
      font-size: 20px;
      width: 300px;
      color: red;
    }
  34. 34.📦 In the box model, which part is the gap to other boxes? (a) margin (b) content (c) border (d) padding
  35. 35.💪 Which justify-content value packs boxes at the start? (a) flex-start (b) center (c) space-between (d) flex-end
  36. 36.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 50px;
      padding: 5px;
      border: 2px solid black;
      margin: 0px;
    }
  37. 37.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 210px;
      justify-content: space-between;
    }
    Inside are 2 boxes, each 100px wide (no margins).
  38. 38.🖌️ Where does the text sit on its line?
    p {
      font-size: 24px;
      text-align: left;
      color: red;
      background-color: purple;
    }
    (a) on the left (b) on the right (c) in the middle
  39. 39.🖌️ What colour is behind the letters?
    li {
      font-size: 20px;
      text-align: right;
      background-color: white;
      color: blue;
    }
    (a) black (b) white (c) blue
  40. 40.🔍 Which is the odd one out? (a) lays out the page (b) adds space around boxes (c) rounds box corners (d) checks a quiz answer

Answer key

  1. reacts to a button click
  2. 24
  3. 294
  4. h1
  5. white
  6. True
  7. 94
  8. red
  9. 30
  10. True
  11. 255
  12. purple
  13. the gap to other boxes
  14. lays out the page
  15. 4
  16. colours behind the text
  17. packs boxes at the start
  18. False
  19. 2px solid
  20. an id selector
  21. border
  22. purple
  23. 36
  24. True
  25. 3
  26. shows a pop-up message
  27. fits every screen
  28. 40
  29. False
  30. 28
  31. 12
  32. False
  33. 4
  34. margin
  35. flex-start
  36. 64
  37. 10
  38. on the left
  39. white
  40. checks a quiz answer

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