← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 252 · 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.🖌️ What colour is behind the letters?
    p {
      text-align: center;
      font-size: 20px;
      color: red;
      background-color: purple;
    }
    (a) red (b) green (c) purple
  2. 2.What does justify-content: flex-start do? (a) packs boxes at the start (b) packs boxes at the end (c) puts boxes in the middle (d) equal gaps, none at ends
  3. 3.💪 Which flexbox property sets space between boxes? (a) flex-direction (b) display: flex (c) justify-content (d) gap
  4. 4.💪 Which flexbox property turns on flexbox? (a) display: flex (b) justify-content (c) align-items (d) flex-direction
  5. 5.✍️ Which property is set to 300px in this rule?
    .box {
      width: 300px;
      margin: 10px;
    }
    (a) 300px (b) width (c) font-style (d) color
  6. 6.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 150px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 60px wide (no margins).
  7. 7.True or false: HTML puts a picture on a page. (a) True (b) False
  8. 8.⚖️ What colour is the text of this element?
    <p class="star" id="end">Hi</p>
    CSS:
    #end { color: black; }
    .star { color: purple; }
    (a) purple (b) green (c) white (d) black
  9. 9.🖌️ Where does the text sit on its line?
    h1 {
      text-align: center;
      font-size: 36px;
      color: yellow;
      background-color: purple;
    }
    (a) on the left (b) in the middle (c) on the right
  10. 10.⚖️ Which selector is the strongest? (a) an element selector (b) a class selector (c) an id selector
  11. 11.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 140px;
      padding: 10px;
      border: 1px solid black;
      margin: 20px;
    }
  12. 12.⚖️ What colour is the text of this element?
    <p class="star" id="end">Hi</p>
    CSS:
    #end { color: purple; }
    #end { color: green; }
    (a) purple (b) yellow (c) green (d) blue
  13. 13.✍️ How many declarations (property: value pairs) are in this rule?
    h2 {
      border: 2px solid;
      color: red;
    }
  14. 14.✍️ What is the selector in this CSS rule?
    p {
      margin: 10px;
      width: 300px;
      border: 2px solid;
    }
    (a) margin (b) 300px (c) p (d) .note
  15. 15.True or false: li is an id selector. (a) True (b) False
  16. 16.✍️ CSS declarations go inside which brackets? (a) [ ] (b) ( ) (c) < > (d) { }
  17. 17.🌈 Which colour is #00ff00? (a) red (b) white (c) magenta (d) bright green
  18. 18.🔍 Which is the odd one out? (a) shows a pop-up message (b) makes headings and lists (c) puts a picture on a page (d) makes a link
  19. 19.✍️ How many declarations (property: value pairs) are in this rule?
    h2 {
      font-size: 20px;
      font-style: italic;
    }
  20. 20.🌈 Which colour is rgb(0, 255, 0)? (a) magenta (b) black (c) bright green (d) blue
  21. 21.✍️ In color: blue; which part is the value? (a) color (b) blue (c) : (d) ;
  22. 22.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 150px;
      padding: 30px;
      border: 3px solid black;
      margin: 5px;
    }
  23. 23.✍️ Which sign goes between a property and its value? (a) ; (b) = (c) - (d) :
  24. 24.🌈 In #00006f the blue part is the hex number 6f. What is it as a normal number?
  25. 25.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 130px;
      padding: 10px;
      border: 1px solid black;
      margin: 20px;
    }
  26. 26.🖌️ Which CSS property centres a heading? (a) background-color (b) text-align (c) font-weight (d) font-family
  27. 27.📱 Which tag helps phones show a page at the right size? (a) the hr tag (b) the viewport meta tag (c) the title tag (d) the br tag
  28. 28.✍️ Which property is set to 300px in this rule?
    .note {
      margin: 10px;
      width: 300px;
    }
    (a) 300px (b) font-style (c) color (d) width
  29. 29.📱 The screen is 540px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 24px;
      }
    }
    (a) No (b) Yes
  30. 30.🌈 Which colour is #00ffff? (a) magenta (b) white (c) red (d) cyan
  31. 31.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 140px;
      padding: 30px;
      border: 2px solid black;
      margin: 15px;
    }
  32. 32.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 8px;
      }
    }
  33. 33.✍️ How many declarations (property: value pairs) are in this rule?
    li {
      border: 2px solid;
    }
  34. 34.🖌️ How big is the text, in px?
    p {
      color: blue;
      background-color: yellow;
      font-size: 40px;
      text-align: left;
    }
  35. 35.What does justify-content: flex-end do? (a) packs boxes at the end (b) puts boxes in the middle (c) equal gaps, none at ends (d) packs boxes at the start
  36. 36.⚖️ What colour is the text of this element?
    <p class="big" id="hero">Hi</p>
    CSS:
    #hero { color: red; }
    .big { color: orange; }
    (a) purple (b) red (c) yellow (d) orange
  37. 37.🖌️ Where does the text sit on its line?
    li {
      text-align: left;
      font-size: 36px;
      color: green;
      background-color: black;
    }
    (a) on the left (b) on the right (c) in the middle
  38. 38.🖌️ What colour are the letters?
    h1 {
      background-color: blue;
      text-align: right;
      font-size: 28px;
      color: red;
    }
    (a) blue (b) yellow (c) red
  39. 39.⚖️ What colour is the text of this element?
    <h1 class="star" id="end">Hi</h1>
    CSS:
    #end { color: black; }
    .star { color: yellow; }
    (a) yellow (b) blue (c) red (d) black
  40. 40.🌈 Which colour is rgb(255, 0, 0)? (a) red (b) blue (c) black (d) bright green

Answer key

  1. purple
  2. packs boxes at the start
  3. gap
  4. display: flex
  5. width
  6. 30
  7. True
  8. black
  9. in the middle
  10. an id selector
  11. 162
  12. green
  13. 2
  14. p
  15. False
  16. { }
  17. bright green
  18. shows a pop-up message
  19. 2
  20. bright green
  21. blue
  22. 226
  23. :
  24. 111
  25. 152
  26. text-align
  27. the viewport meta tag
  28. width
  29. No
  30. cyan
  31. 234
  32. 12
  33. 1
  34. 40
  35. packs boxes at the end
  36. red
  37. on the left
  38. red
  39. black
  40. red

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