← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 312 · 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.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 240px;
      padding: 5px;
      border: 4px solid black;
      margin: 10px;
    }
  2. 2.🖌️ What colour is behind the letters?
    h1 {
      background-color: black;
      font-size: 20px;
      text-align: center;
      color: purple;
    }
    (a) purple (b) black (c) blue
  3. 3.🌈 In #000008 the blue part is the hex number 08. What is it as a normal number?
  4. 4.Which of these does JavaScript do? (a) rounds box corners (b) adds space around boxes (c) lays out the page (d) checks a quiz answer
  5. 5.🌈 Which colour is rgb(0, 255, 0)? (a) bright green (b) blue (c) white (d) red
  6. 6.✍️ How many declarations (property: value pairs) are in this rule?
    .note {
      font-size: 20px;
    }
  7. 7.⚖️ Which selector is the strongest? (a) a class selector (b) an element selector (c) an id selector
  8. 8.🖌️ What colour is behind the letters?
    p {
      font-size: 24px;
      text-align: right;
      color: red;
      background-color: orange;
    }
    (a) orange (b) black (c) red
  9. 9.📱 max-width: 600px applies when the screen is ___. (a) turned off (b) 600px or narrower (c) 600px or wider (d) exactly 1000px
  10. 10.✍️ Which sign ends each CSS declaration? (a) , (b) ; (c) . (d) :
  11. 11.True or false: margin is space outside the border. (a) True (b) False
  12. 12.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 12px;
      }
    }
  13. 13.Which of these is the border? (a) the gap to other boxes (b) the text or picture (c) a solid or dotted edge (d) space inside the border
  14. 14.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 20px;
      }
    }
    (a) No (b) Yes
  15. 15.✍️ What value is given to color in this rule?
    #top {
      color: red;
      font-style: italic;
    }
    (a) red (b) center (c) color (d) 20px
  16. 16.Which of these does HTML do? (a) puts a picture on a page (b) reacts to a button click (c) lays out the page (d) changes the text size
  17. 17.🖌️ What colour is behind the letters?
    p {
      text-align: center;
      color: green;
      font-size: 12px;
      background-color: orange;
    }
    (a) yellow (b) green (c) orange
  18. 18.💪 Which justify-content value packs boxes at the start? (a) flex-end (b) center (c) space-between (d) flex-start
  19. 19.True or false: padding is the gap round content. (a) False (b) True
  20. 20.🔍 Which is the odd one out? (a) reacts to a button click (b) shows a pop-up message (c) checks a quiz answer (d) puts a picture on a page
  21. 21.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 14px;
      }
    }
    (a) No (b) Yes
  22. 22.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the first one (b) the later one (c) neither (d) the shorter one
  23. 23.🌈 Which colour of light is strongest in rgb(99, 193, 38)? (a) green (b) red (c) blue
  24. 24.🌈 In #rrggbb, which colour do the first two digits give? (a) red (b) green (c) blue (d) black
  25. 25.✍️ What value is given to padding in this rule?
    p {
      font-weight: bold;
      padding: 8px;
      width: 300px;
    }
    (a) bold (b) 2px solid (c) padding (d) 8px
  26. 26.Which of these does JavaScript do? (a) counts down a timer (b) gives the page structure (c) rounds box corners (d) makes a form box
  27. 27.🔍 Which is the odd one out? (a) changes the text size (b) rounds box corners (c) lays out the page (d) makes headings and lists
  28. 28.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 300px;
      justify-content: center;
    }
    Inside are 4 boxes, each 40px wide (no margins).
  29. 29.Which of these does HTML do? (a) shows a pop-up message (b) makes a link (c) counts down a timer (d) reacts to a button click
  30. 30.📱 min-width: 800px applies when the screen is ___. (a) 800px or wider (b) turned off (c) 800px or narrower (d) exactly 100px
  31. 31.⚖️ What colour is the text of this element?
    <p class="red" id="end">Hi</p>
    CSS:
    p { color: white; }
    p { color: green; }
    (a) white (b) green (c) yellow (d) purple
  32. 32.True or false: the content is space outside the border. (a) True (b) False
  33. 33.What does font-size do? (a) sets the letter colour (b) colours behind the text (c) centres a heading (d) makes letters bigger
  34. 34.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 50px;
      padding: 15px;
      border: 1px solid black;
      margin: 5px;
    }
  35. 35.🌈 Which colour is rgb(255, 255, 0)? (a) white (b) blue (c) yellow (d) red
  36. 36.What does background-color do? (a) colours behind the text (b) centres a heading (c) makes letters bigger (d) makes the text bold
  37. 37.🖌️ What colour are the letters?
    p {
      text-align: center;
      font-size: 40px;
      color: red;
      background-color: orange;
    }
    (a) green (b) red (c) orange
  38. 38.🧩 Which language adds space around boxes? (a) JavaScript (b) CSS (c) HTML
  39. 39.✍️ What value is given to margin in this rule?
    .note {
      width: 300px;
      margin: 10px;
    }
    (a) 10px (b) 8px (c) margin (d) bold
  40. 40.✍️ How many declarations (property: value pairs) are in this rule?
    h2 {
      text-align: center;
      margin: 10px;
    }

Answer key

  1. 278
  2. black
  3. 8
  4. checks a quiz answer
  5. bright green
  6. 1
  7. an id selector
  8. orange
  9. 600px or narrower
  10. ;
  11. True
  12. 12
  13. a solid or dotted edge
  14. No
  15. red
  16. puts a picture on a page
  17. orange
  18. flex-start
  19. True
  20. puts a picture on a page
  21. Yes
  22. the later one
  23. green
  24. red
  25. 8px
  26. counts down a timer
  27. makes headings and lists
  28. 70
  29. makes a link
  30. 800px or wider
  31. green
  32. False
  33. makes letters bigger
  34. 92
  35. yellow
  36. colours behind the text
  37. red
  38. CSS
  39. 10px
  40. 2

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