← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 434 · 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.True or false: CSS sets colours and fonts. (a) True (b) False
  2. 2.🌈 Which colour is rgb(255, 255, 255)? (a) blue (b) red (c) cyan (d) white
  3. 3.📱 The screen is 540px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 14px;
      }
    }
    (a) Yes (b) No
  4. 4.🔍 Which is the odd one out? (a) puts a picture on a page (b) makes a link (c) makes a form box (d) reacts to a button click
  5. 5.🧩 Which language changes the page live? (a) JavaScript (b) HTML (c) CSS
  6. 6.🎯 Can many elements share the same class? (a) No (b) Yes
  7. 7.True or false: p is an id selector. (a) False (b) True
  8. 8.🖌️ What colour is behind the letters?
    p {
      font-size: 20px;
      color: purple;
      text-align: center;
      background-color: black;
    }
    (a) purple (b) black (c) white
  9. 9.💪 Which flexbox property turns on flexbox? (a) justify-content (b) gap (c) flex-direction (d) display: flex
  10. 10.What does justify-content: space-between 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
  11. 11.💪 Which flexbox property lines boxes up across? (a) align-items (b) flex-direction (c) gap (d) display: flex
  12. 12.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 300px;
      padding: 5px;
      border: 2px solid black;
      margin: 15px;
    }
  13. 13.⚖️ Which selector is the strongest? (a) a class selector (b) an element selector (c) an id selector
  14. 14.🌈 Which colour is rgb(0, 255, 255)? (a) red (b) blue (c) bright green (d) cyan
  15. 15.🌈 Which colour is #000000? (a) blue (b) cyan (c) black (d) white
  16. 16.📱 min-width: 800px applies when the screen is ___. (a) 800px or narrower (b) turned off (c) 800px or wider (d) exactly 100px
  17. 17.🖌️ How big is the text, in px?
    li {
      background-color: white;
      font-size: 16px;
      text-align: center;
      color: green;
    }
  18. 18.🌈 In #130000 the red part is the hex number 13. What is it as a normal number?
  19. 19.✍️ What value is given to text-align in this rule?
    .note {
      font-size: 20px;
      text-align: center;
    }
    (a) 10px (b) center (c) text-align (d) yellow
  20. 20.🖌️ Which CSS property centres a heading? (a) font-family (b) font-size (c) text-align (d) color
  21. 21.What does font-weight do? (a) sets the letter colour (b) centres a heading (c) makes letters bigger (d) makes the text bold
  22. 22.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 240px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 100px wide (no margins).
  23. 23.📱 What does a media query check? (a) the page title (b) the screen width (c) the time of day (d) the battery level
  24. 24.🎯 Which element does the selector .big style? (a) <h2 class="red"> (b) <li class="box"> (c) <h2 id="big"> (d) <h2 class="big">
  25. 25.What does justify-content: flex-start do? (a) packs boxes at the end (b) puts boxes in the middle (c) packs boxes at the start (d) equal gaps, none at ends
  26. 26.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 260px;
      justify-content: flex-start;
    }
    Inside are 3 boxes, each 60px wide (no margins).
  27. 27.🖌️ Which CSS property sets the letter colour? (a) font-family (b) font-size (c) background-color (d) color
  28. 28.🎯 Which CSS selector matches this element?
    <h1 class="menu" id="end">Hello</h1>
    (a) #end (b) #menu (c) .note (d) #hero
  29. 29.🖌️ Where does the text sit on its line?
    h1 {
      background-color: green;
      font-size: 24px;
      color: black;
      text-align: right;
    }
    (a) on the right (b) on the left (c) in the middle
  30. 30.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 110px;
      padding: 10px;
      border: 1px solid black;
      margin: 20px;
    }
  31. 31.🎯 Which element does the selector h2 style? (a) <li> (b) <div class="star"> (c) <h2 class="star"> (d) <span id="logo">
  32. 32.True or false: HTML gives the page structure. (a) True (b) False
  33. 33.True or false: HTML reacts to a button click. (a) False (b) True
  34. 34.What does font-family do? (a) colours behind the text (b) sets the letter colour (c) picks the font style (d) makes letters bigger
  35. 35.🎯 Which sign starts a class selector? (a) # (b) @ (c) & (d) .
  36. 36.⚖️ What colour is the text of this element?
    <h2 class="menu" id="top">Hi</h2>
    CSS:
    h2 { color: white; }
    h2 { color: blue; }
    (a) red (b) blue (c) white (d) green
  37. 37.⚖️ What colour is the text of this element?
    <p class="note" id="main">Hi</p>
    CSS:
    .note { color: blue; }
    p { color: purple; }
    (a) yellow (b) purple (c) green (d) blue
  38. 38.🎯 How many elements on a page should have the same id? (a) 2 (b) 5 (c) any number (d) 1
  39. 39.What does font-size do? (a) centres a heading (b) makes letters bigger (c) picks the font style (d) makes the text bold
  40. 40.✍️ What is the selector in this CSS rule?
    h2 {
      font-size: 20px;
      font-style: italic;
    }
    (a) font-size (b) h1 (c) italic (d) h2

Answer key

  1. True
  2. white
  3. Yes
  4. reacts to a button click
  5. JavaScript
  6. Yes
  7. False
  8. black
  9. display: flex
  10. equal gaps, none at ends
  11. align-items
  12. 314
  13. an id selector
  14. cyan
  15. black
  16. 800px or wider
  17. 16
  18. 19
  19. center
  20. text-align
  21. makes the text bold
  22. 40
  23. the screen width
  24. <h2 class="big">
  25. packs boxes at the start
  26. 80
  27. color
  28. #end
  29. on the right
  30. 172
  31. <h2 class="star">
  32. True
  33. False
  34. picks the font style
  35. .
  36. blue
  37. blue
  38. 1
  39. makes letters bigger
  40. h2

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