← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 186 · 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: the border is the line round the box. (a) False (b) True
  2. 2.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 8px;
      }
    }
    (a) No (b) Yes
  3. 3.📱 The screen is 1100px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 32px;
      }
    }
    (a) No (b) Yes
  4. 4.🖌️ What colour is behind the letters?
    h2 {
      text-align: center;
      color: black;
      background-color: purple;
      font-size: 16px;
    }
    (a) purple (b) blue (c) black
  5. 5.📦 In the box model, which part is the gap round content? (a) border (b) margin (c) content (d) padding
  6. 6.✍️ What is the selector in this CSS rule?
    h1 {
      font-size: 20px;
      margin: 10px;
    }
    (a) p (b) h1 (c) font-size (d) 10px
  7. 7.📱 max-width: 600px applies when the screen is ___. (a) 600px or wider (b) turned off (c) exactly 1000px (d) 600px or narrower
  8. 8.🌈 Which colour is #ffff00? (a) magenta (b) bright green (c) yellow (d) cyan
  9. 9.⚖️ What colour is the text of this element?
    <p class="star" id="top">Hi</p>
    CSS:
    .star { color: red; }
    .star { color: green; }
    (a) red (b) white (c) black (d) green
  10. 10.📦 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: 30px;
      border: 1px solid black;
      margin: 0px;
    }
  11. 11.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 130px;
      justify-content: flex-start;
    }
    Inside are 3 boxes, each 40px wide (no margins).
  12. 12.✍️ How many declarations (property: value pairs) are in this rule?
    p {
      padding: 8px;
      border: 2px solid;
      color: red;
    }
  13. 13.🌈 Which colour of light is strongest in rgb(215, 60, 118)? (a) green (b) blue (c) red
  14. 14.🖌️ Which CSS property picks the font style? (a) background-color (b) font-family (c) text-align (d) font-weight
  15. 15.⚖️ What colour is the text of this element?
    <h2 class="star" id="intro">Hi</h2>
    CSS:
    .star { color: white; }
    h2 { color: black; }
    #intro { color: blue; }
    (a) red (b) white (c) blue (d) black
  16. 16.📦 In the box model, which part is the text or picture? (a) margin (b) border (c) content (d) padding
  17. 17.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 180px;
      justify-content: flex-end;
    }
    Inside are 4 boxes, each 40px wide (no margins).
  18. 18.🖌️ What colour are the letters?
    h2 {
      font-size: 16px;
      color: red;
      text-align: left;
      background-color: blue;
    }
    (a) red (b) purple (c) blue
  19. 19.🖌️ What colour is behind the letters?
    h1 {
      background-color: red;
      font-size: 24px;
      color: black;
      text-align: left;
    }
    (a) yellow (b) black (c) red
  20. 20.Which of these is the border? (a) the text or picture (b) space inside the border (c) the gap round content (d) a solid or dotted edge
  21. 21.🌈 What is the biggest number one colour can have in rgb()? (a) 100 (b) 99 (c) 255 (d) 1000
  22. 22.🌈 Which colour is rgb(0, 0, 0)? (a) blue (b) black (c) yellow (d) white
  23. 23.💪 Which justify-content value puts boxes in the middle? (a) space-between (b) center (c) flex-end (d) flex-start
  24. 24.💪 Which flexbox property picks row or column? (a) flex-direction (b) justify-content (c) align-items (d) gap
  25. 25.What does justify-content: flex-start do? (a) packs boxes at the start (b) equal gaps, none at ends (c) packs boxes at the end (d) puts boxes in the middle
  26. 26.🖌️ How big is the text, in px?
    h2 {
      background-color: red;
      font-size: 40px;
      text-align: left;
      color: black;
    }
  27. 27.🎯 Which element does the selector #end style? (a) <p id="hero"> (b) <p id="end"> (c) <h1 class="star"> (d) <p class="end">
  28. 28.✍️ What is the selector in this CSS rule?
    h1 {
      color: red;
      font-weight: bold;
      background-color: yellow;
      text-align: center;
    }
    (a) h1 (b) bold (c) p (d) color
  29. 29.True or false: the border is a solid or dotted edge. (a) True (b) False
  30. 30.🔍 Which is the odd one out? (a) gives the page structure (b) shows a pop-up message (c) makes headings and lists (d) makes a link
  31. 31.True or false: JavaScript changes the page live. (a) True (b) False
  32. 32.✍️ Which sign goes between a property and its value? (a) = (b) - (c) : (d) ;
  33. 33.🖌️ Which CSS property centres a heading? (a) font-family (b) background-color (c) text-align (d) color
  34. 34.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 260px;
      justify-content: center;
    }
    Inside are 2 boxes, each 50px wide (no margins).
  35. 35.True or false: CSS gives the page structure. (a) False (b) True
  36. 36.📱 Responsive design means a page ___. (a) has no pictures (b) fits every screen (c) never changes (d) is only for laptops
  37. 37.🎯 What kind of selector is .menu? (a) an id selector (b) a class selector (c) an element selector
  38. 38.What does background-color do? (a) makes the text bold (b) makes letters bigger (c) colours behind the text (d) picks the font style
  39. 39.True or false: HTML checks a quiz answer. (a) False (b) True
  40. 40.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the later one (b) neither (c) the first one (d) the shorter one

Answer key

  1. True
  2. Yes
  3. Yes
  4. purple
  5. padding
  6. h1
  7. 600px or narrower
  8. yellow
  9. green
  10. 332
  11. 10
  12. 3
  13. red
  14. font-family
  15. blue
  16. content
  17. 20
  18. red
  19. red
  20. a solid or dotted edge
  21. 255
  22. black
  23. center
  24. flex-direction
  25. packs boxes at the start
  26. 40
  27. <p id="end">
  28. h1
  29. True
  30. shows a pop-up message
  31. True
  32. :
  33. text-align
  34. 80
  35. False
  36. fits every screen
  37. a class selector
  38. colours behind the text
  39. False
  40. the later one

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