← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 745 · 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.📦 In the box model, which part is the gap to other boxes? (a) content (b) border (c) padding (d) margin
  2. 2.🖌️ Which CSS property makes letters bigger? (a) color (b) font-size (c) background-color (d) text-align
  3. 3.True or false: HTML makes a form box. (a) True (b) False
  4. 4.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 240px;
      justify-content: flex-start;
    }
    Inside are 3 boxes, each 60px wide (no margins).
  5. 5.✍️ Which property is set to 10px in this rule?
    .note {
      font-style: italic;
      margin: 10px;
    }
    (a) margin (b) padding (c) 10px (d) font-weight
  6. 6.🌈 Which colour of light is strongest in rgb(33, 214, 78)? (a) green (b) blue (c) red
  7. 7.⚖️ What colour is the text of this element?
    <p class="note" id="intro">Hi</p>
    CSS:
    #intro { color: purple; }
    #intro { color: green; }
    (a) green (b) purple (c) yellow (d) orange
  8. 8.🖌️ Which CSS property picks the font style? (a) color (b) background-color (c) text-align (d) font-family
  9. 9.🧩 Which language rounds box corners? (a) JavaScript (b) HTML (c) CSS
  10. 10.✍️ Which sign ends each CSS declaration? (a) . (b) : (c) , (d) ;
  11. 11.🖌️ What colour is behind the letters?
    p {
      font-size: 28px;
      text-align: center;
      color: blue;
      background-color: orange;
    }
    (a) blue (b) orange (c) red
  12. 12.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 220px;
      justify-content: flex-end;
    }
    Inside are 4 boxes, each 50px wide (no margins).
  13. 13.✍️ How many declarations (property: value pairs) are in this rule?
    p {
      text-align: center;
      font-weight: bold;
      background-color: yellow;
      color: red;
    }
  14. 14.🧩 Which language changes the text size? (a) JavaScript (b) HTML (c) CSS
  15. 15.✍️ Which sign goes between a property and its value? (a) ; (b) : (c) = (d) -
  16. 16.⚖️ Two rules with the same selector set a colour. Which one wins? (a) neither (b) the later one (c) the first one (d) the shorter one
  17. 17.📱 The screen is 1100px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 18px;
      }
    }
    (a) Yes (b) No
  18. 18.🖌️ Which CSS property makes the text bold? (a) color (b) text-align (c) font-family (d) font-weight
  19. 19.⚖️ What colour is the text of this element?
    <p class="note" id="hero">Hi</p>
    CSS:
    #hero { color: red; }
    p { color: yellow; }
    (a) red (b) green (c) blue (d) yellow
  20. 20.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 20px;
      }
    }
  21. 21.📱 The screen is 414px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 14px;
      }
    }
    (a) No (b) Yes
  22. 22.True or false: body is an id selector. (a) True (b) False
  23. 23.🌈 In #rrggbb, which colour do the first two digits give? (a) green (b) black (c) red (d) blue
  24. 24.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 250px;
      justify-content: flex-start;
    }
    Inside are 4 boxes, each 50px wide (no margins).
  25. 25.🌈 Which colour of light is strongest in rgb(30, 185, 33)? (a) green (b) red (c) blue
  26. 26.🖌️ What colour is behind the letters?
    li {
      color: red;
      text-align: right;
      background-color: orange;
      font-size: 20px;
    }
    (a) blue (b) red (c) orange
  27. 27.🎯 Which CSS selector matches this element?
    <h1 class="big" id="hero">Hello</h1>
    (a) h2 (b) #hero (c) .red (d) #big
  28. 28.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 410px;
      justify-content: flex-start;
    }
    Inside are 4 boxes, each 100px wide (no margins).
  29. 29.True or false: margin is space outside the border. (a) True (b) False
  30. 30.📦 In the box model, which part is the gap round content? (a) border (b) padding (c) content (d) margin
  31. 31.🎯 What kind of selector is img? (a) an id selector (b) an element selector (c) a class selector
  32. 32.What does justify-content: space-between 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
  33. 33.📱 Which tag helps phones show a page at the right size? (a) the hr tag (b) the br tag (c) the title tag (d) the viewport meta tag
  34. 34.🌈 Which colour is #ff0000? (a) bright green (b) cyan (c) yellow (d) red
  35. 35.🔍 Which is the odd one out? (a) puts a picture on a page (b) makes headings and lists (c) rounds box corners (d) makes a form box
  36. 36.📱 What does a media query check? (a) the time of day (b) the battery level (c) the screen width (d) the page title
  37. 37.📱 max-width: 600px applies when the screen is ___. (a) exactly 1000px (b) turned off (c) 600px or narrower (d) 600px or wider
  38. 38.📦 In the box model, which part is the text or picture? (a) margin (b) border (c) content (d) padding
  39. 39.🖌️ What colour is behind the letters?
    p {
      text-align: left;
      color: yellow;
      font-size: 36px;
      background-color: orange;
    }
    (a) orange (b) yellow (c) blue
  40. 40.⚖️ What colour is the text of this element?
    <h2 class="star" id="intro">Hi</h2>
    CSS:
    #intro { color: orange; }
    #intro { color: green; }
    (a) orange (b) green (c) blue (d) purple

Answer key

  1. margin
  2. font-size
  3. True
  4. 60
  5. margin
  6. green
  7. green
  8. font-family
  9. CSS
  10. ;
  11. orange
  12. 20
  13. 4
  14. CSS
  15. :
  16. the later one
  17. Yes
  18. font-weight
  19. red
  20. 12
  21. Yes
  22. False
  23. red
  24. 50
  25. green
  26. orange
  27. #hero
  28. 10
  29. True
  30. padding
  31. an element selector
  32. equal gaps, none at ends
  33. the viewport meta tag
  34. red
  35. rounds box corners
  36. the screen width
  37. 600px or narrower
  38. content
  39. orange
  40. green

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