← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 238 · 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 kind of selector is #top? (a) an id selector (b) an element selector (c) a class selector
  2. 2.🎨 One CSS file can style how many pages? (a) only one word (b) only one image (c) many pages (d) no pages
  3. 3.⚖️ What colour is the text of this element?
    <h1 class="red" id="logo">Hi</h1>
    CSS:
    .red { color: yellow; }
    .red { color: blue; }
    (a) yellow (b) orange (c) red (d) blue
  4. 4.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 270px;
      justify-content: space-between;
    }
    Inside are 4 boxes, each 60px wide (no margins).
  5. 5.🖌️ Which CSS property makes the text bold? (a) background-color (b) font-family (c) text-align (d) font-weight
  6. 6.What does justify-content: flex-end do? (a) puts boxes in the middle (b) packs boxes at the end (c) packs boxes at the start (d) equal gaps, none at ends
  7. 7.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 12px;
      }
    }
  8. 8.📱 Responsive design means a page ___. (a) has no pictures (b) is only for laptops (c) never changes (d) fits every screen
  9. 9.📱 The screen is 1366px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 14px;
      }
    }
    (a) Yes (b) No
  10. 10.What does justify-content: space-between do? (a) packs boxes at the start (b) puts boxes in the middle (c) packs boxes at the end (d) equal gaps, none at ends
  11. 11.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 160px;
      justify-content: flex-end;
    }
    Inside are 2 boxes, each 60px wide (no margins).
  12. 12.💪 Which flexbox property lines boxes up across? (a) justify-content (b) display: flex (c) align-items (d) gap
  13. 13.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 140px;
      padding: 30px;
      border: 4px solid black;
      margin: 5px;
    }
  14. 14.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 140px;
      justify-content: center;
    }
    Inside are 2 boxes, each 40px wide (no margins).
  15. 15.🎯 Which sign starts a class selector? (a) & (b) @ (c) . (d) #
  16. 16.📦 In the box model, which part is the gap round content? (a) content (b) padding (c) margin (d) border
  17. 17.🧩 Which language changes the text size? (a) HTML (b) JavaScript (c) CSS
  18. 18.What does background-color do? (a) colours behind the text (b) makes the text bold (c) picks the font style (d) sets the letter colour
  19. 19.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 20px;
      }
    }
  20. 20.⚖️ What colour is the text of this element?
    <h2 class="red" id="top">Hi</h2>
    CSS:
    h2 { color: orange; }
    .red { color: black; }
    #top { color: yellow; }
    (a) orange (b) yellow (c) blue (d) black
  21. 21.📱 Which tag helps phones show a page at the right size? (a) the br tag (b) the hr tag (c) the title tag (d) the viewport meta tag
  22. 22.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 10px;
      }
    }
  23. 23.⚖️ What colour is the text of this element?
    <h1 class="big" id="hero">Hi</h1>
    CSS:
    #hero { color: black; }
    .big { color: purple; }
    h1 { color: yellow; }
    (a) yellow (b) purple (c) orange (d) black
  24. 24.True or false: CSS makes headings and lists. (a) False (b) True
  25. 25.🌈 In #4c0000 the red part is the hex number 4c. What is it as a normal number?
  26. 26.🧩 Which language checks a quiz answer? (a) JavaScript (b) CSS (c) HTML
  27. 27.✍️ How many declarations (property: value pairs) are in this rule?
    li {
      width: 300px;
      padding: 8px;
      font-style: italic;
      margin: 10px;
    }
  28. 28.🌈 Which colour of light is strongest in rgb(69, 192, 100)? (a) green (b) red (c) blue
  29. 29.What does font-family do? (a) makes letters bigger (b) makes the text bold (c) picks the font style (d) centres a heading
  30. 30.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 4 (b) 2 (c) 6 (d) 3
  31. 31.💪 Which justify-content value packs boxes at the start? (a) flex-end (b) space-between (c) center (d) flex-start
  32. 32.What does font-size do? (a) colours behind the text (b) centres a heading (c) makes letters bigger (d) picks the font style
  33. 33.🧩 Which language puts a picture on a page? (a) JavaScript (b) CSS (c) HTML
  34. 34.✍️ How many declarations (property: value pairs) are in this rule?
    h2 {
      color: red;
      font-weight: bold;
    }
  35. 35.💪 Which flexbox property picks row or column? (a) display: flex (b) gap (c) justify-content (d) flex-direction
  36. 36.🎯 What kind of selector is h1? (a) an id selector (b) a class selector (c) an element selector
  37. 37.📱 The screen is 1366px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 28px;
      }
    }
    (a) No (b) Yes
  38. 38.📱 The screen is 414px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 20px;
      }
    }
    (a) No (b) Yes
  39. 39.🌈 Which hex code is black? (a) #ffff00 (b) #0000ff (c) #000000 (d) #ff00ff
  40. 40.🖌️ What colour are the letters?
    h1 {
      color: orange;
      background-color: white;
      text-align: left;
      font-size: 28px;
    }
    (a) white (b) orange (c) green

Answer key

  1. an id selector
  2. many pages
  3. blue
  4. 10
  5. font-weight
  6. packs boxes at the end
  7. 12
  8. fits every screen
  9. No
  10. equal gaps, none at ends
  11. 40
  12. align-items
  13. 218
  14. 30
  15. .
  16. padding
  17. CSS
  18. colours behind the text
  19. 20
  20. yellow
  21. the viewport meta tag
  22. 16
  23. black
  24. False
  25. 76
  26. JavaScript
  27. 4
  28. green
  29. picks the font style
  30. 3
  31. flex-start
  32. makes letters bigger
  33. HTML
  34. 2
  35. flex-direction
  36. an element selector
  37. Yes
  38. Yes
  39. #000000
  40. orange

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