← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 937 · 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 does text-align do? (a) makes the text bold (b) centres a heading (c) colours behind the text (d) picks the font style
  2. 2.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 50px;
      padding: 10px;
      border: 3px solid black;
      margin: 20px;
    }
  3. 3.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 240px;
      justify-content: center;
    }
    Inside are 3 boxes, each 60px wide (no margins).
  4. 4.✍️ How many declarations (property: value pairs) are in this rule?
    p {
      font-size: 20px;
      margin: 10px;
      font-weight: bold;
    }
  5. 5.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 260px;
      padding: 5px;
      border: 1px solid black;
      margin: 5px;
    }
  6. 6.🌈 Which colour of light is strongest in rgb(12, 105, 193)? (a) blue (b) red (c) green
  7. 7.🎯 What kind of selector is .note? (a) an element selector (b) an id selector (c) a class selector
  8. 8.🌈 In #rrggbb, which colour do the first two digits give? (a) red (b) blue (c) green (d) black
  9. 9.⚖️ Which selector is the weakest? (a) a class selector (b) an id selector (c) an element selector
  10. 10.✍️ What value is given to background-color in this rule?
    .note {
      background-color: yellow;
      color: red;
    }
    (a) 10px (b) 8px (c) yellow (d) background-color
  11. 11.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 16px;
      }
    }
  12. 12.✍️ Which sign ends each CSS declaration? (a) : (b) . (c) ; (d) ,
  13. 13.🧩 Which language counts down a timer? (a) JavaScript (b) HTML (c) CSS
  14. 14.🌈 Which colour of light is strongest in rgb(3, 50, 196)? (a) green (b) blue (c) red
  15. 15.✍️ What value is given to background-color in this rule?
    li {
      background-color: yellow;
      font-size: 20px;
    }
    (a) yellow (b) background-color (c) 10px (d) 8px
  16. 16.💪 Which flexbox property lines boxes up across? (a) display: flex (b) gap (c) flex-direction (d) align-items
  17. 17.🌈 Which hex code is bright green? (a) #00ff00 (b) #ff0000 (c) #00ffff (d) #ffff00
  18. 18.🖌️ Which CSS property makes the text bold? (a) color (b) font-weight (c) font-family (d) font-size
  19. 19.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the first one (b) the shorter one (c) the later one (d) neither
  20. 20.🌈 Which colour is rgb(0, 0, 255)? (a) cyan (b) magenta (c) blue (d) red
  21. 21.📱 The screen is 414px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 10px;
      }
    }
    (a) Yes (b) No
  22. 22.📱 The screen is 1366px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 18px;
      }
    }
    (a) No (b) Yes
  23. 23.🌈 Which colour is rgb(255, 0, 0)? (a) white (b) magenta (c) red (d) cyan
  24. 24.✍️ How does a CSS comment start? (a) <!-- (b) # (c) // (d) /*
  25. 25.🎯 What kind of selector is body? (a) a class selector (b) an id selector (c) an element selector
  26. 26.✍️ Which property is set to 2px solid in this rule?
    .box {
      width: 300px;
      border: 2px solid;
      font-weight: bold;
    }
    (a) font-style (b) 2px solid (c) width (d) border
  27. 27.⚖️ Which selector is the strongest? (a) an element selector (b) an id selector (c) a class selector
  28. 28.What does font-family do? (a) makes letters bigger (b) picks the font style (c) centres a heading (d) sets the letter colour
  29. 29.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 16px;
      }
    }
  30. 30.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 32px;
      }
    }
    (a) No (b) Yes
  31. 31.🎯 Which sign starts a class selector? (a) # (b) . (c) @ (d) &
  32. 32.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 210px;
      justify-content: center;
    }
    Inside are 3 boxes, each 50px wide (no margins).
  33. 33.📱 max-width: 600px applies when the screen is ___. (a) exactly 1000px (b) 600px or narrower (c) turned off (d) 600px or wider
  34. 34.🎨 One CSS file can style how many pages? (a) many pages (b) only one word (c) only one image (d) no pages
  35. 35.✍️ Which property is set to 8px in this rule?
    p {
      padding: 8px;
      margin: 10px;
    }
    (a) border (b) 8px (c) padding (d) font-weight
  36. 36.🎯 Which element does the selector div style? (a) <p class="star"> (b) <div class="star"> (c) <h1 id="top"> (d) <span>
  37. 37.🔍 Which is the odd one out? (a) makes a form box (b) puts a picture on a page (c) makes headings and lists (d) rounds box corners
  38. 38.🎯 Which CSS selector matches this element?
    <span class="big" id="top">Hello</span>
    (a) #big (b) #intro (c) p (d) #top
  39. 39.🖌️ How big is the text, in px?
    h1 {
      color: blue;
      font-size: 12px;
      text-align: left;
      background-color: purple;
    }
  40. 40.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 70px;
      padding: 25px;
      border: 1px solid black;
      margin: 15px;
    }

Answer key

  1. centres a heading
  2. 76
  3. 30
  4. 3
  5. 272
  6. blue
  7. a class selector
  8. red
  9. an element selector
  10. yellow
  11. 20
  12. ;
  13. JavaScript
  14. blue
  15. yellow
  16. align-items
  17. #00ff00
  18. font-weight
  19. the later one
  20. blue
  21. Yes
  22. No
  23. red
  24. /*
  25. an element selector
  26. border
  27. an id selector
  28. picks the font style
  29. 16
  30. No
  31. .
  32. 30
  33. 600px or narrower
  34. many pages
  35. padding
  36. <div class="star">
  37. rounds box corners
  38. #top
  39. 12
  40. 122

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