← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 120 · 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.🖌️ Where does the text sit on its line?
    h1 {
      text-align: left;
      color: green;
      font-size: 16px;
      background-color: purple;
    }
    (a) in the middle (b) on the left (c) on the right
  2. 2.✍️ How many declarations (property: value pairs) are in this rule?
    #top {
      font-weight: bold;
      font-size: 20px;
      border: 2px solid;
    }
  3. 3.🌈 Hex digits go 0 to 9, then A to which letter? (a) Z (b) F (c) G (d) J
  4. 4.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 220px;
      justify-content: flex-start;
    }
    Inside are 3 boxes, each 50px wide (no margins).
  5. 5.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
  6. 6.🎨 Which tag connects an outside CSS file? (a) <a> (b) <img> (c) <link> (d) <css>
  7. 7.💪 Which justify-content value packs boxes at the start? (a) center (b) space-between (c) flex-start (d) flex-end
  8. 8.🎯 Which sign starts an id selector? (a) & (b) # (c) @ (d) .
  9. 9.True or false: JavaScript counts down a timer. (a) False (b) True
  10. 10.🌈 Which hex code is red? (a) #ffffff (b) #ffff00 (c) #000000 (d) #ff0000
  11. 11.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 220px;
      justify-content: flex-start;
    }
    Inside are 4 boxes, each 40px wide (no margins).
  12. 12.🔍 Which is the odd one out? (a) makes headings and lists (b) puts a picture on a page (c) adds space around boxes (d) makes a link
  13. 13.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 200px;
      justify-content: center;
    }
    Inside are 2 boxes, each 40px wide (no margins).
  14. 14.🌈 Which colour is rgb(255, 255, 255)? (a) white (b) cyan (c) black (d) magenta
  15. 15.⚖️ What colour is the text of this element?
    <h1 class="menu" id="hero">Hi</h1>
    CSS:
    h1 { color: white; }
    #hero { color: green; }
    (a) white (b) red (c) black (d) green
  16. 16.⚖️ What colour is the text of this element?
    <p class="star" id="hero">Hi</p>
    CSS:
    p { color: red; }
    p { color: black; }
    (a) blue (b) black (c) purple (d) red
  17. 17.⚖️ What colour is the text of this element?
    <p class="box" id="main">Hi</p>
    CSS:
    #main { color: orange; }
    #main { color: red; }
    (a) red (b) white (c) orange (d) green
  18. 18.🎯 What kind of selector is h1? (a) an id selector (b) a class selector (c) an element selector
  19. 19.What does color do? (a) centres a heading (b) sets the letter colour (c) colours behind the text (d) makes the text bold
  20. 20.🖌️ What colour are the letters?
    h1 {
      color: blue;
      text-align: center;
      font-size: 24px;
      background-color: purple;
    }
    (a) blue (b) orange (c) purple
  21. 21.🎯 Which element does the selector div style? (a) <span> (b) <div class="red"> (c) <p class="red"> (d) <h1 id="top">
  22. 22.True or false: img is an id selector. (a) False (b) True
  23. 23.📱 The screen is 414px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 22px;
      }
    }
    (a) Yes (b) No
  24. 24.True or false: .star is a class selector. (a) True (b) False
  25. 25.📱 max-width: 600px applies when the screen is ___. (a) exactly 1000px (b) 600px or narrower (c) turned off (d) 600px or wider
  26. 26.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 230px;
      padding: 5px;
      border: 1px solid black;
      margin: 15px;
    }
  27. 27.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 26px;
      }
    }
    (a) Yes (b) No
  28. 28.✍️ Which property is set to italic in this rule?
    .box {
      font-style: italic;
      text-align: center;
      color: red;
    }
    (a) font-size (b) font-style (c) color (d) italic
  29. 29.✍️ Which property is set to 20px in this rule?
    p {
      text-align: center;
      color: red;
      font-size: 20px;
      border: 2px solid;
    }
    (a) text-align (b) font-size (c) 20px (d) background-color
  30. 30.🖌️ Which CSS property centres a heading? (a) text-align (b) font-size (c) color (d) font-family
  31. 31.🔍 Which is the odd one out? (a) counts down a timer (b) changes the page live (c) shows a pop-up message (d) puts a picture on a page
  32. 32.✍️ Which property is set to bold in this rule?
    li {
      background-color: yellow;
      font-weight: bold;
    }
    (a) font-weight (b) border (c) bold (d) width
  33. 33.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 100px;
      padding: 20px;
      border: 3px solid black;
      margin: 10px;
    }
  34. 34.✍️ In color: blue; which part is the property? (a) : (b) blue (c) ; (d) color
  35. 35.Which of these does JavaScript do? (a) makes headings and lists (b) reacts to a button click (c) lays out the page (d) gives the page structure
  36. 36.True or false: the border is the line round the box. (a) True (b) False
  37. 37.🖌️ How big is the text, in px?
    h1 {
      font-size: 32px;
      text-align: left;
      color: orange;
      background-color: white;
    }
  38. 38.🎨 What does CSS stand for? (a) Colourful Site Styles (b) Cascading Style Sheets (c) Creative Sheet System (d) Computer Style Sheets
  39. 39.✍️ What value is given to background-color in this rule?
    .box {
      background-color: yellow;
      width: 300px;
    }
    (a) background-color (b) 10px (c) yellow (d) 8px
  40. 40.⚖️ What colour is the text of this element?
    <p class="red" id="end">Hi</p>
    CSS:
    #end { color: white; }
    #end { color: green; }
    (a) green (b) blue (c) white (d) black

Answer key

  1. on the left
  2. 3
  3. F
  4. 70
  5. equal gaps, none at ends
  6. <link>
  7. flex-start
  8. #
  9. True
  10. #ff0000
  11. 60
  12. adds space around boxes
  13. 60
  14. white
  15. green
  16. black
  17. red
  18. an element selector
  19. sets the letter colour
  20. blue
  21. <div class="red">
  22. False
  23. Yes
  24. True
  25. 600px or narrower
  26. 242
  27. No
  28. font-style
  29. font-size
  30. text-align
  31. puts a picture on a page
  32. font-weight
  33. 166
  34. color
  35. reacts to a button click
  36. True
  37. 32
  38. Cascading Style Sheets
  39. yellow
  40. green

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