← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 770 · 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 selector is the strongest? (a) an id selector (b) an element selector (c) a class selector
  2. 2.✍️ Which property is set to red in this rule?
    p {
      margin: 10px;
      color: red;
      text-align: center;
      background-color: yellow;
    }
    (a) font-size (b) color (c) red (d) text-align
  3. 3.✍️ What value is given to border in this rule?
    .box {
      padding: 8px;
      font-style: italic;
      border: 2px solid;
    }
    (a) 2px solid (b) italic (c) border (d) 300px
  4. 4.✍️ What value is given to padding in this rule?
    .note {
      padding: 8px;
      border: 2px solid;
      text-align: center;
    }
    (a) 8px (b) 2px solid (c) padding (d) bold
  5. 5.✍️ Which sign goes between a property and its value? (a) : (b) = (c) ; (d) -
  6. 6.🖌️ Where does the text sit on its line?
    h2 {
      font-size: 24px;
      background-color: white;
      color: black;
      text-align: right;
    }
    (a) on the left (b) on the right (c) in the middle
  7. 7.📱 The screen is 820px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 32px;
      }
    }
    (a) Yes (b) No
  8. 8.⚖️ What colour is the text of this element?
    <h1 class="note" id="end">Hi</h1>
    CSS:
    .note { color: white; }
    .note { color: purple; }
    (a) purple (b) green (c) orange (d) white
  9. 9.🖌️ Where does the text sit on its line?
    li {
      text-align: right;
      color: red;
      font-size: 20px;
      background-color: white;
    }
    (a) on the left (b) in the middle (c) on the right
  10. 10.✍️ How does a CSS comment start? (a) /* (b) # (c) // (d) <!--
  11. 11.✍️ Which property is set to italic in this rule?
    .box {
      border: 2px solid;
      font-style: italic;
      text-align: center;
    }
    (a) color (b) font-style (c) italic (d) font-size
  12. 12.💪 Which flexbox property spaces boxes along a row? (a) align-items (b) flex-direction (c) display: flex (d) justify-content
  13. 13.Which of these does HTML do? (a) changes the text size (b) adds space around boxes (c) rounds box corners (d) makes a form box
  14. 14.True or false: margin is space inside the border. (a) True (b) False
  15. 15.What does justify-content: flex-end do? (a) packs boxes at the end (b) puts boxes in the middle (c) equal gaps, none at ends (d) packs boxes at the start
  16. 16.🖌️ Which CSS property colours behind the text? (a) text-align (b) font-size (c) background-color (d) color
  17. 17.🎯 What kind of selector is .big? (a) a class selector (b) an element selector (c) an id selector
  18. 18.✍️ How many declarations (property: value pairs) are in this rule?
    .note {
      background-color: yellow;
      width: 300px;
      color: red;
      font-style: italic;
    }
  19. 19.True or false: padding is space inside the border. (a) True (b) False
  20. 20.💪 Which flexbox property turns on flexbox? (a) gap (b) justify-content (c) align-items (d) display: flex
  21. 21.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 180px;
      padding: 20px;
      border: 5px solid black;
      margin: 5px;
    }
  22. 22.📱 The screen is 1366px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 20px;
      }
    }
    (a) No (b) Yes
  23. 23.🌈 Which colour is rgb(255, 255, 255)? (a) blue (b) white (c) magenta (d) black
  24. 24.📱 max-width: 600px applies when the screen is ___. (a) turned off (b) 600px or wider (c) exactly 1000px (d) 600px or narrower
  25. 25.True or false: the border is the gap round content. (a) False (b) True
  26. 26.🌈 Which colour is #ffff00? (a) red (b) magenta (c) yellow (d) cyan
  27. 27.🔍 Which is the odd one out? (a) lays out the page (b) reacts to a button click (c) checks a quiz answer (d) shows a pop-up message
  28. 28.True or false: CSS reacts to a button click. (a) True (b) False
  29. 29.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 180px;
      padding: 15px;
      border: 5px solid black;
      margin: 5px;
    }
  30. 30.True or false: CSS counts down a timer. (a) True (b) False
  31. 31.🖌️ How big is the text, in px?
    h1 {
      font-size: 32px;
      color: green;
      text-align: right;
      background-color: purple;
    }
  32. 32.Which of these does CSS do? (a) gives the page structure (b) makes a link (c) adds space around boxes (d) makes headings and lists
  33. 33.🧩 Which language gives the page structure? (a) CSS (b) JavaScript (c) HTML
  34. 34.True or false: .menu is an element selector. (a) True (b) False
  35. 35.✍️ What value is given to font-size in this rule?
    h2 {
      padding: 8px;
      font-size: 20px;
    }
    (a) center (b) 20px (c) font-size (d) yellow
  36. 36.⚖️ What colour is the text of this element?
    <p class="red" id="intro">Hi</p>
    CSS:
    #intro { color: purple; }
    .red { color: red; }
    p { color: white; }
    (a) purple (b) white (c) black (d) red
  37. 37.🌈 In #rrggbb, which colour do the last two digits give? (a) white (b) red (c) blue (d) green
  38. 38.🔍 Which is the odd one out? (a) changes the page live (b) makes headings and lists (c) checks a quiz answer (d) counts down a timer
  39. 39.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 120px;
      padding: 20px;
      border: 3px solid black;
      margin: 15px;
    }
  40. 40.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 240px;
      justify-content: space-between;
    }
    Inside are 3 boxes, each 60px wide (no margins).

Answer key

  1. an id selector
  2. color
  3. 2px solid
  4. 8px
  5. :
  6. on the right
  7. Yes
  8. purple
  9. on the right
  10. /*
  11. font-style
  12. justify-content
  13. makes a form box
  14. False
  15. packs boxes at the end
  16. background-color
  17. a class selector
  18. 4
  19. True
  20. display: flex
  21. 240
  22. Yes
  23. white
  24. 600px or narrower
  25. False
  26. yellow
  27. lays out the page
  28. False
  29. 230
  30. False
  31. 32
  32. adds space around boxes
  33. HTML
  34. False
  35. 20px
  36. purple
  37. blue
  38. makes headings and lists
  39. 166
  40. 30

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