← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 483 · 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.🖌️ Which CSS property colours behind the text? (a) background-color (b) font-weight (c) text-align (d) font-size
  2. 2.🎯 Which element does the selector h2 style? (a) <li> (b) <h2 class="note"> (c) <span id="top"> (d) <div class="note">
  3. 3.🧩 Which language rounds box corners? (a) HTML (b) JavaScript (c) CSS
  4. 4.True or false: #end is an element selector. (a) True (b) False
  5. 5.⚖️ What colour is the text of this element?
    <p class="big" id="logo">Hi</p>
    CSS:
    p { color: yellow; }
    p { color: white; }
    (a) yellow (b) blue (c) black (d) white
  6. 6.🌈 In #008200 the green part is the hex number 82. What is it as a normal number?
  7. 7.📦 In the box model, which part is space inside the border? (a) margin (b) border (c) padding (d) content
  8. 8.⚖️ What colour is the text of this element?
    <h2 class="big" id="top">Hi</h2>
    CSS:
    .big { color: yellow; }
    .big { color: white; }
    (a) yellow (b) green (c) purple (d) white
  9. 9.💪 Which justify-content value packs boxes at the start? (a) center (b) flex-start (c) flex-end (d) space-between
  10. 10.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 160px;
      justify-content: flex-end;
    }
    Inside are 2 boxes, each 40px wide (no margins).
  11. 11.🔍 Which is the odd one out? (a) makes a link (b) gives the page structure (c) makes a form box (d) sets colours and fonts
  12. 12.⚖️ Which selector is the strongest? (a) an element selector (b) an id selector (c) a class selector
  13. 13.📱 The screen is 1100px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 18px;
      }
    }
    (a) Yes (b) No
  14. 14.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 480px;
      justify-content: center;
    }
    Inside are 4 boxes, each 100px wide (no margins).
  15. 15.True or false: HTML makes a form box. (a) True (b) False
  16. 16.📱 The screen is 1100px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 18px;
      }
    }
    (a) Yes (b) No
  17. 17.True or false: HTML makes a link. (a) True (b) False
  18. 18.📦 In the box model, which part is space outside the border? (a) border (b) margin (c) padding (d) content
  19. 19.⚖️ What colour is the text of this element?
    <p class="big" id="hero">Hi</p>
    CSS:
    .big { color: white; }
    p { color: orange; }
    (a) blue (b) orange (c) white (d) black
  20. 20.✍️ Which property is set to red in this rule?
    body {
      color: red;
      font-size: 20px;
      padding: 8px;
      font-weight: bold;
    }
    (a) font-size (b) text-align (c) red (d) color
  21. 21.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 6 (b) 3 (c) 4 (d) 2
  22. 22.🌈 Which colour is #ff0000? (a) cyan (b) red (c) yellow (d) white
  23. 23.✍️ CSS declarations go inside which brackets? (a) ( ) (b) { } (c) [ ] (d) < >
  24. 24.💪 Which flexbox property spaces boxes along a row? (a) align-items (b) flex-direction (c) justify-content (d) display: flex
  25. 25.📱 Which tag helps phones show a page at the right size? (a) the br tag (b) the title tag (c) the viewport meta tag (d) the hr tag
  26. 26.🖌️ Which CSS property picks the font style? (a) color (b) font-weight (c) text-align (d) font-family
  27. 27.🎨 One CSS file can style how many pages? (a) no pages (b) only one image (c) only one word (d) many pages
  28. 28.🎨 Which tag connects an outside CSS file? (a) <a> (b) <css> (c) <link> (d) <img>
  29. 29.🖌️ Which CSS property makes the text bold? (a) text-align (b) font-family (c) font-size (d) font-weight
  30. 30.🎯 Which element does the selector #main style? (a) <li id="logo"> (b) <li class="main"> (c) <div class="note"> (d) <li id="main">
  31. 31.🎯 What kind of selector is #end? (a) an id selector (b) a class selector (c) an element selector
  32. 32.⚖️ What colour is the text of this element?
    <h1 class="big" id="intro">Hi</h1>
    CSS:
    h1 { color: blue; }
    h1 { color: red; }
    (a) blue (b) red (c) orange (d) purple
  33. 33.⚖️ Two rules with the same selector set a colour. Which one wins? (a) neither (b) the shorter one (c) the first one (d) the later one
  34. 34.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 24px;
      }
    }
  35. 35.⚖️ What colour is the text of this element?
    <p class="note" id="main">Hi</p>
    CSS:
    #main { color: purple; }
    #main { color: black; }
    (a) green (b) yellow (c) black (d) purple
  36. 36.🌈 In #rrggbb, which colour do the first two digits give? (a) blue (b) black (c) green (d) red
  37. 37.True or false: CSS sets colours and fonts. (a) False (b) True
  38. 38.True or false: margin is the gap to other boxes. (a) True (b) False
  39. 39.✍️ Which property is set to 2px solid in this rule?
    .box {
      border: 2px solid;
      font-weight: bold;
    }
    (a) 2px solid (b) border (c) width (d) font-style
  40. 40.True or false: CSS counts down a timer. (a) True (b) False

Answer key

  1. background-color
  2. <h2 class="note">
  3. CSS
  4. False
  5. white
  6. 130
  7. padding
  8. white
  9. flex-start
  10. 80
  11. sets colours and fonts
  12. an id selector
  13. No
  14. 40
  15. True
  16. Yes
  17. True
  18. margin
  19. white
  20. color
  21. 3
  22. red
  23. { }
  24. justify-content
  25. the viewport meta tag
  26. font-family
  27. many pages
  28. <link>
  29. font-weight
  30. <li id="main">
  31. an id selector
  32. red
  33. the later one
  34. 16
  35. black
  36. red
  37. True
  38. True
  39. border
  40. False

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