← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 556 · 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 colour is the text of this element?
    <h1 class="star" id="top">Hi</h1>
    CSS:
    #top { color: white; }
    h1 { color: yellow; }
    .star { color: orange; }
    (a) white (b) yellow (c) red (d) orange
  2. 2.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 230px;
      justify-content: space-between;
    }
    Inside are 2 boxes, each 100px wide (no margins).
  3. 3.✍️ Which property is set to 8px in this rule?
    p {
      text-align: center;
      padding: 8px;
    }
    (a) padding (b) border (c) font-weight (d) 8px
  4. 4.💪 Which flexbox property turns on flexbox? (a) gap (b) justify-content (c) flex-direction (d) display: flex
  5. 5.🎯 Which CSS selector matches this element?
    <p class="note" id="end">Hello</p>
    (a) .end (b) h1 (c) #note (d) .note
  6. 6.✍️ Which sign goes between a property and its value? (a) - (b) = (c) ; (d) :
  7. 7.🌈 Which colour is rgb(0, 0, 0)? (a) cyan (b) red (c) black (d) blue
  8. 8.Which of these does JavaScript do? (a) reacts to a button click (b) gives the page structure (c) puts a picture on a page (d) changes the text size
  9. 9.🎯 Can many elements share the same class? (a) Yes (b) No
  10. 10.🖌️ Which CSS property sets the letter colour? (a) font-family (b) text-align (c) background-color (d) color
  11. 11.🔍 Which is the odd one out? (a) lays out the page (b) sets colours and fonts (c) rounds box corners (d) shows a pop-up message
  12. 12.🌈 Which colour is rgb(0, 255, 255)? (a) black (b) bright green (c) cyan (d) red
  13. 13.🌈 Which colour is #ffff00? (a) yellow (b) white (c) magenta (d) red
  14. 14.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 32px;
      }
    }
    (a) Yes (b) No
  15. 15.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 28px;
      }
    }
    (a) No (b) Yes
  16. 16.What does justify-content: space-between 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
  17. 17.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 150px;
      padding: 20px;
      border: 2px solid black;
      margin: 5px;
    }
  18. 18.🌈 Which colour is rgb(255, 0, 255)? (a) magenta (b) red (c) black (d) cyan
  19. 19.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 100px;
      justify-content: space-between;
    }
    Inside are 2 boxes, each 40px wide (no margins).
  20. 20.🎯 Which CSS selector matches this element?
    <h2 class="star" id="logo">Hello</h2>
    (a) li (b) h2 (c) #end (d) #star
  21. 21.What does font-size do? (a) colours behind the text (b) makes letters bigger (c) picks the font style (d) sets the letter colour
  22. 22.⚖️ Which selector is the strongest? (a) a class selector (b) an id selector (c) an element selector
  23. 23.🔍 Which is the odd one out? (a) makes a link (b) puts a picture on a page (c) makes a form box (d) rounds box corners
  24. 24.✍️ What value is given to font-size in this rule?
    h2 {
      width: 300px;
      font-size: 20px;
    }
    (a) yellow (b) center (c) font-size (d) 20px
  25. 25.🎯 Which CSS selector matches this element?
    <h1 class="box" id="intro">Hello</h1>
    (a) h2 (b) .star (c) .intro (d) h1
  26. 26.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 18px;
      }
    }
  27. 27.Which of these is the content? (a) space outside the border (b) the text or picture (c) space inside the border (d) the line round the box
  28. 28.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 140px;
      justify-content: flex-end;
    }
    Inside are 3 boxes, each 40px wide (no margins).
  29. 29.🌈 In #rrggbb, which colour do the first two digits give? (a) black (b) blue (c) green (d) red
  30. 30.True or false: CSS lays out the page. (a) False (b) True
  31. 31.🔍 Which is the odd one out? (a) puts a picture on a page (b) reacts to a button click (c) makes headings and lists (d) makes a form box
  32. 32.🌈 In #rrggbb, which colour do the last two digits give? (a) green (b) blue (c) white (d) red
  33. 33.📱 max-width: 600px applies when the screen is ___. (a) turned off (b) exactly 1000px (c) 600px or narrower (d) 600px or wider
  34. 34.📱 Which tag helps phones show a page at the right size? (a) the viewport meta tag (b) the hr tag (c) the title tag (d) the br tag
  35. 35.🖌️ Which CSS property makes the text bold? (a) font-size (b) font-family (c) font-weight (d) text-align
  36. 36.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 280px;
      padding: 20px;
      border: 2px solid black;
      margin: 15px;
    }
  37. 37.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 16px;
      }
    }
  38. 38.🖌️ What colour is behind the letters?
    li {
      color: purple;
      font-size: 28px;
      text-align: right;
      background-color: green;
    }
    (a) green (b) purple (c) blue
  39. 39.⚖️ What colour is the text of this element?
    <p class="box" id="top">Hi</p>
    CSS:
    p { color: white; }
    .box { color: purple; }
    (a) white (b) black (c) purple (d) red
  40. 40.⚖️ Which selector is the weakest? (a) a class selector (b) an id selector (c) an element selector

Answer key

  1. white
  2. 30
  3. padding
  4. display: flex
  5. .note
  6. :
  7. black
  8. reacts to a button click
  9. Yes
  10. color
  11. shows a pop-up message
  12. cyan
  13. yellow
  14. No
  15. No
  16. equal gaps, none at ends
  17. 204
  18. magenta
  19. 20
  20. h2
  21. makes letters bigger
  22. an id selector
  23. rounds box corners
  24. 20px
  25. h1
  26. 12
  27. the text or picture
  28. 20
  29. red
  30. True
  31. reacts to a button click
  32. blue
  33. 600px or narrower
  34. the viewport meta tag
  35. font-weight
  36. 354
  37. 12
  38. green
  39. purple
  40. an element selector

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