← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 875 · 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 sets the letter colour? (a) font-weight (b) color (c) background-color (d) text-align
  2. 2.🔍 Which is the odd one out? (a) sets colours and fonts (b) adds space around boxes (c) shows a pop-up message (d) lays out the page
  3. 3.✍️ What is the selector in this CSS rule?
    li {
      font-style: italic;
      margin: 10px;
    }
    (a) body (b) li (c) 10px (d) font-style
  4. 4.🌈 Which colour of light is strongest in rgb(240, 92, 73)? (a) green (b) red (c) blue
  5. 5.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 120px;
      padding: 15px;
      border: 2px solid black;
      margin: 15px;
    }
  6. 6.📱 The screen is 1366px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 16px;
      }
    }
    (a) No (b) Yes
  7. 7.What does justify-content: flex-start do? (a) equal gaps, none at ends (b) packs boxes at the end (c) packs boxes at the start (d) puts boxes in the middle
  8. 8.📱 The screen is 700px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 16px;
      }
    }
    (a) Yes (b) No
  9. 9.🎯 Which sign starts an id selector? (a) & (b) # (c) @ (d) .
  10. 10.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 6px;
      }
    }
  11. 11.🎯 Which element does the selector #end style? (a) <h2 id="end"> (b) <h2 id="hero"> (c) <li class="big"> (d) <h2 class="end">
  12. 12.🎯 Which element does the selector .menu style? (a) <li class="menu"> (b) <li class="note"> (c) <div class="big"> (d) <li id="menu">
  13. 13.🎯 What kind of selector is .star? (a) an element selector (b) a class selector (c) an id selector
  14. 14.🔍 Which is the odd one out? (a) lays out the page (b) sets colours and fonts (c) changes the text size (d) puts a picture on a page
  15. 15.✍️ What is the selector in this CSS rule?
    .note {
      text-align: center;
      color: red;
      font-weight: bold;
    }
    (a) #top (b) text-align (c) .note (d) red
  16. 16.🎯 How many elements on a page should have the same id? (a) 1 (b) 5 (c) 2 (d) any number
  17. 17.💪 Which flexbox property turns on flexbox? (a) align-items (b) justify-content (c) flex-direction (d) display: flex
  18. 18.True or false: HTML reacts to a button click. (a) True (b) False
  19. 19.📱 What does a media query check? (a) the page title (b) the time of day (c) the screen width (d) the battery level
  20. 20.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 460px;
      justify-content: flex-end;
    }
    Inside are 4 boxes, each 100px wide (no margins).
  21. 21.🖌️ What colour are the letters?
    p {
      background-color: orange;
      color: red;
      text-align: left;
      font-size: 28px;
    }
    (a) red (b) black (c) orange
  22. 22.🎯 Which CSS selector matches this element?
    <span class="star" id="top">Hello</span>
    (a) #star (b) .menu (c) .top (d) span
  23. 23.Which of these does CSS do? (a) sets colours and fonts (b) counts down a timer (c) checks a quiz answer (d) makes a form box
  24. 24.✍️ Which property is set to 8px in this rule?
    h1 {
      font-weight: bold;
      padding: 8px;
      color: red;
    }
    (a) font-weight (b) 8px (c) border (d) padding
  25. 25.✍️ CSS declarations go inside which brackets? (a) < > (b) ( ) (c) [ ] (d) { }
  26. 26.🎯 Which element does the selector #logo style? (a) <h2 class="red"> (b) <h1 id="logo"> (c) <h1 class="logo"> (d) <h1 id="end">
  27. 27.🎨 A CSS file usually ends with which extension? (a) .js (b) .png (c) .css (d) .html
  28. 28.⚖️ What colour is the text of this element?
    <h1 class="menu" id="intro">Hi</h1>
    CSS:
    h1 { color: green; }
    #intro { color: red; }
    (a) red (b) purple (c) green (d) black
  29. 29.Which of these does CSS do? (a) gives the page structure (b) changes the page live (c) checks a quiz answer (d) lays out the page
  30. 30.✍️ How many declarations (property: value pairs) are in this rule?
    body {
      text-align: center;
      font-style: italic;
    }
  31. 31.✍️ What value is given to margin in this rule?
    body {
      margin: 10px;
      width: 300px;
      text-align: center;
    }
    (a) 8px (b) margin (c) 10px (d) bold
  32. 32.💪 Which flexbox property lines boxes up across? (a) display: flex (b) gap (c) flex-direction (d) align-items
  33. 33.✍️ How many declarations (property: value pairs) are in this rule?
    li {
      color: red;
      text-align: center;
      width: 300px;
    }
  34. 34.✍️ Which property is set to 2px solid in this rule?
    .box {
      background-color: yellow;
      width: 300px;
      text-align: center;
      border: 2px solid;
    }
    (a) border (b) font-style (c) width (d) 2px solid
  35. 35.True or false: JavaScript changes the text size. (a) True (b) False
  36. 36.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 50px;
      padding: 5px;
      border: 4px solid black;
      margin: 5px;
    }
  37. 37.🌈 What is the biggest number one colour can have in rgb()? (a) 100 (b) 99 (c) 255 (d) 1000
  38. 38.🌈 Which colour of light is strongest in rgb(58, 251, 114)? (a) blue (b) green (c) red
  39. 39.🖌️ What colour is behind the letters?
    p {
      background-color: purple;
      color: yellow;
      font-size: 16px;
      text-align: center;
    }
    (a) yellow (b) white (c) purple
  40. 40.🌈 Which colour is rgb(255, 255, 0)? (a) yellow (b) red (c) magenta (d) black

Answer key

  1. color
  2. shows a pop-up message
  3. li
  4. red
  5. 184
  6. Yes
  7. packs boxes at the start
  8. No
  9. #
  10. 6
  11. <h2 id="end">
  12. <li class="menu">
  13. a class selector
  14. puts a picture on a page
  15. .note
  16. 1
  17. display: flex
  18. False
  19. the screen width
  20. 60
  21. red
  22. span
  23. sets colours and fonts
  24. padding
  25. { }
  26. <h1 id="logo">
  27. .css
  28. red
  29. lays out the page
  30. 2
  31. 10px
  32. align-items
  33. 3
  34. border
  35. False
  36. 78
  37. 255
  38. green
  39. purple
  40. yellow

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