← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 595 · 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.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 14px;
      }
    }
  2. 2.🌈 Which colour is #000000? (a) blue (b) black (c) white (d) cyan
  3. 3.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 20px;
      }
    }
  4. 4.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 220px;
      padding: 5px;
      border: 2px solid black;
      margin: 15px;
    }
  5. 5.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the shorter one (b) neither (c) the later one (d) the first one
  6. 6.🎯 What kind of selector is h1? (a) a class selector (b) an element selector (c) an id selector
  7. 7.🌈 In #rrggbb, which colour do the last two digits give? (a) white (b) green (c) red (d) blue
  8. 8.✍️ How many declarations (property: value pairs) are in this rule?
    #top {
      color: red;
      text-align: center;
      margin: 10px;
      width: 300px;
    }
  9. 9.🔍 Which is the odd one out? (a) makes a link (b) counts down a timer (c) gives the page structure (d) puts a picture on a page
  10. 10.True or false: .big is a class selector. (a) True (b) False
  11. 11.📱 Responsive design means a page ___. (a) never changes (b) fits every screen (c) is only for laptops (d) has no pictures
  12. 12.True or false: #hero is an id selector. (a) False (b) True
  13. 13.📦 In the box model, which part is the line round the box? (a) margin (b) content (c) border (d) padding
  14. 14.What does justify-content: flex-end do? (a) puts boxes in the middle (b) equal gaps, none at ends (c) packs boxes at the start (d) packs boxes at the end
  15. 15.🎨 Which tag holds CSS inside the head? (a) <style> (b) <body> (c) <css> (d) <script>
  16. 16.✍️ What is the selector in this CSS rule?
    .box {
      color: red;
      background-color: yellow;
    }
    (a) color (b) yellow (c) h2 (d) .box
  17. 17.⚖️ What colour is the text of this element?
    <p class="red" id="logo">Hi</p>
    CSS:
    p { color: orange; }
    .red { color: red; }
    (a) orange (b) white (c) yellow (d) red
  18. 18.True or false: the border is space inside the border. (a) True (b) False
  19. 19.🎨 Which tag connects an outside CSS file? (a) <css> (b) <link> (c) <img> (d) <a>
  20. 20.🖌️ Where does the text sit on its line?
    h2 {
      text-align: right;
      color: white;
      background-color: red;
      font-size: 20px;
    }
    (a) on the right (b) on the left (c) in the middle
  21. 21.True or false: HTML rounds box corners. (a) False (b) True
  22. 22.✍️ What value is given to font-size in this rule?
    .note {
      font-size: 20px;
      text-align: center;
    }
    (a) font-size (b) center (c) 20px (d) yellow
  23. 23.🖌️ Which CSS property colours behind the text? (a) color (b) font-size (c) background-color (d) font-family
  24. 24.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 6px;
      }
    }
    (a) Yes (b) No
  25. 25.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 110px;
      padding: 25px;
      border: 4px solid black;
      margin: 0px;
    }
  26. 26.🖌️ Which CSS property makes letters bigger? (a) color (b) font-size (c) font-family (d) text-align
  27. 27.✍️ What value is given to margin in this rule?
    h1 {
      margin: 10px;
      color: red;
    }
    (a) 10px (b) margin (c) 8px (d) bold
  28. 28.Which of these does CSS do? (a) makes a link (b) makes headings and lists (c) gives the page structure (d) changes the text size
  29. 29.📱 The screen is 1366px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 32px;
      }
    }
    (a) No (b) Yes
  30. 30.💪 Which flexbox property spaces boxes along a row? (a) justify-content (b) display: flex (c) flex-direction (d) gap
  31. 31.Which of these is margin? (a) the text or picture (b) the gap round content (c) space outside the border (d) a solid or dotted edge
  32. 32.What does text-align do? (a) colours behind the text (b) centres a heading (c) picks the font style (d) makes the text bold
  33. 33.⚖️ What colour is the text of this element?
    <p class="star" id="logo">Hi</p>
    CSS:
    p { color: green; }
    #logo { color: orange; }
    (a) red (b) green (c) orange (d) blue
  34. 34.📱 The screen is 414px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 28px;
      }
    }
    (a) No (b) Yes
  35. 35.True or false: p is a class selector. (a) True (b) False
  36. 36.📱 Which tag helps phones show a page at the right size? (a) the hr tag (b) the title tag (c) the br tag (d) the viewport meta tag
  37. 37.🌈 In #000031 the blue part is the hex number 31. What is it as a normal number?
  38. 38.💪 Which flexbox property lines boxes up across? (a) justify-content (b) display: flex (c) align-items (d) flex-direction
  39. 39.🎯 What kind of selector is .big? (a) an id selector (b) an element selector (c) a class selector
  40. 40.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 140px;
      justify-content: space-between;
    }
    Inside are 2 boxes, each 40px wide (no margins).

Answer key

  1. 16
  2. black
  3. 20
  4. 264
  5. the later one
  6. an element selector
  7. blue
  8. 4
  9. counts down a timer
  10. True
  11. fits every screen
  12. True
  13. border
  14. packs boxes at the end
  15. <style>
  16. .box
  17. red
  18. False
  19. <link>
  20. on the right
  21. False
  22. 20px
  23. background-color
  24. Yes
  25. 168
  26. font-size
  27. 10px
  28. changes the text size
  29. Yes
  30. justify-content
  31. space outside the border
  32. centres a heading
  33. orange
  34. No
  35. False
  36. the viewport meta tag
  37. 49
  38. align-items
  39. a class selector
  40. 60

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