← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 816 · 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 space across (px) does this box take in all, margin included?
    .box {
      width: 70px;
      padding: 30px;
      border: 4px solid black;
      margin: 5px;
    }
  2. 2.🌈 Which colour is #00ffff? (a) white (b) red (c) cyan (d) yellow
  3. 3.🔍 Which is the odd one out? (a) gives the page structure (b) puts a picture on a page (c) makes a form box (d) rounds box corners
  4. 4.🧩 Which language puts a picture on a page? (a) JavaScript (b) HTML (c) CSS
  5. 5.🎯 Which element does the selector .star style? (a) <h1 class="note"> (b) <p class="menu"> (c) <p class="star"> (d) <p id="star">
  6. 6.🌈 Which colour is #ff0000? (a) red (b) yellow (c) blue (d) bright green
  7. 7.🎯 What kind of selector is img? (a) an element selector (b) an id selector (c) a class selector
  8. 8.🖌️ How big is the text, in px?
    p {
      color: purple;
      font-size: 28px;
      background-color: black;
      text-align: left;
    }
  9. 9.💪 Which flexbox property spaces boxes along a row? (a) flex-direction (b) align-items (c) justify-content (d) display: flex
  10. 10.Which of these is the border? (a) space inside the border (b) the text or picture (c) the gap to other boxes (d) a solid or dotted edge
  11. 11.What does justify-content: flex-end do? (a) equal gaps, none at ends (b) packs boxes at the start (c) puts boxes in the middle (d) packs boxes at the end
  12. 12.🎯 How many elements on a page should have the same id? (a) any number (b) 2 (c) 1 (d) 5
  13. 13.⚖️ What colour is the text of this element?
    <h1 class="red" id="intro">Hi</h1>
    CSS:
    .red { color: red; }
    .red { color: white; }
    (a) purple (b) red (c) blue (d) white
  14. 14.💪 Which flexbox property lines boxes up across? (a) display: flex (b) align-items (c) gap (d) flex-direction
  15. 15.⚖️ What colour is the text of this element?
    <p class="red" id="top">Hi</p>
    CSS:
    .red { color: purple; }
    #top { color: orange; }
    (a) purple (b) yellow (c) orange (d) green
  16. 16.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the shorter one (b) the later one (c) neither (d) the first one
  17. 17.🎯 Which element does the selector .big style? (a) <span class="big"> (b) <span id="big"> (c) <p class="box"> (d) <span class="red">
  18. 18.⚖️ What colour is the text of this element?
    <h2 class="note" id="end">Hi</h2>
    CSS:
    h2 { color: green; }
    h2 { color: red; }
    (a) blue (b) green (c) black (d) red
  19. 19.🖌️ How big is the text, in px?
    h1 {
      font-size: 20px;
      background-color: red;
      color: purple;
      text-align: left;
    }
  20. 20.🌈 In #rrggbb, which colour do the first two digits give? (a) red (b) black (c) blue (d) green
  21. 21.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 14px;
      }
    }
  22. 22.✍️ What value is given to width in this rule?
    li {
      width: 300px;
      font-size: 20px;
      text-align: center;
    }
    (a) 300px (b) red (c) italic (d) width
  23. 23.✍️ In color: blue; which part is the property? (a) ; (b) color (c) : (d) blue
  24. 24.🧩 Which language makes headings and lists? (a) JavaScript (b) CSS (c) HTML
  25. 25.🧩 Which language changes the page live? (a) HTML (b) CSS (c) JavaScript
  26. 26.🧩 Which language adds space around boxes? (a) CSS (b) JavaScript (c) HTML
  27. 27.🧩 Which language rounds box corners? (a) HTML (b) CSS (c) JavaScript
  28. 28.📱 The screen is 820px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 14px;
      }
    }
    (a) Yes (b) No
  29. 29.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 40px;
      padding: 20px;
      border: 2px solid black;
      margin: 10px;
    }
  30. 30.🖌️ What colour is behind the letters?
    p {
      background-color: purple;
      font-size: 28px;
      text-align: center;
      color: black;
    }
    (a) purple (b) black (c) yellow
  31. 31.📦 In the box model, which part is space inside the border? (a) margin (b) content (c) padding (d) border
  32. 32.🎯 What kind of selector is .star? (a) an element selector (b) a class selector (c) an id selector
  33. 33.🖌️ Which CSS property picks the font style? (a) font-size (b) font-family (c) text-align (d) color
  34. 34.💪 Which justify-content value packs boxes at the start? (a) center (b) space-between (c) flex-start (d) flex-end
  35. 35.⚖️ What colour is the text of this element?
    <p class="red" id="intro">Hi</p>
    CSS:
    .red { color: black; }
    #intro { color: yellow; }
    (a) orange (b) yellow (c) blue (d) black
  36. 36.🖌️ Which CSS property colours behind the text? (a) color (b) background-color (c) font-family (d) font-weight
  37. 37.⚖️ What colour is the text of this element?
    <p class="big" id="top">Hi</p>
    CSS:
    .big { color: purple; }
    .big { color: red; }
    (a) blue (b) red (c) purple (d) orange
  38. 38.True or false: CSS makes a link. (a) False (b) True
  39. 39.🌈 In #a50000 the red part is the hex number a5. What is it as a normal number?
  40. 40.🖌️ What colour is behind the letters?
    li {
      text-align: right;
      color: yellow;
      font-size: 36px;
      background-color: green;
    }
    (a) red (b) yellow (c) green

Answer key

  1. 148
  2. cyan
  3. rounds box corners
  4. HTML
  5. <p class="star">
  6. red
  7. an element selector
  8. 28
  9. justify-content
  10. a solid or dotted edge
  11. packs boxes at the end
  12. 1
  13. white
  14. align-items
  15. orange
  16. the later one
  17. <span class="big">
  18. red
  19. 20
  20. red
  21. 14
  22. 300px
  23. color
  24. HTML
  25. JavaScript
  26. CSS
  27. CSS
  28. No
  29. 104
  30. purple
  31. padding
  32. a class selector
  33. font-family
  34. flex-start
  35. yellow
  36. background-color
  37. red
  38. False
  39. 165
  40. green

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