← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 931 · 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.🌈 Hex digits go 0 to 9, then A to which letter? (a) J (b) G (c) Z (d) F
  2. 2.🎯 Which sign starts a class selector? (a) # (b) & (c) @ (d) .
  3. 3.✍️ What value is given to text-align in this rule?
    .note {
      width: 300px;
      text-align: center;
    }
    (a) yellow (b) text-align (c) center (d) 10px
  4. 4.True or false: the border is the text or picture. (a) True (b) False
  5. 5.Which of these does JavaScript do? (a) puts a picture on a page (b) makes headings and lists (c) reacts to a button click (d) gives the page structure
  6. 6.🖌️ Where does the text sit on its line?
    h1 {
      font-size: 40px;
      background-color: yellow;
      color: orange;
      text-align: center;
    }
    (a) in the middle (b) on the right (c) on the left
  7. 7.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 260px;
      padding: 10px;
      border: 3px solid black;
      margin: 0px;
    }
  8. 8.🎯 How many elements on a page should have the same id? (a) any number (b) 2 (c) 1 (d) 5
  9. 9.What does justify-content: center do? (a) packs boxes at the end (b) packs boxes at the start (c) puts boxes in the middle (d) equal gaps, none at ends
  10. 10.💪 Which flexbox property lines boxes up across? (a) gap (b) align-items (c) justify-content (d) display: flex
  11. 11.📱 max-width: 600px applies when the screen is ___. (a) exactly 1000px (b) 600px or narrower (c) 600px or wider (d) turned off
  12. 12.⚖️ What colour is the text of this element?
    <p class="box" id="top">Hi</p>
    CSS:
    #top { color: orange; }
    #top { color: yellow; }
    (a) red (b) yellow (c) blue (d) orange
  13. 13.⚖️ What colour is the text of this element?
    <h2 class="star" id="hero">Hi</h2>
    CSS:
    h2 { color: white; }
    h2 { color: purple; }
    (a) green (b) white (c) red (d) purple
  14. 14.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 280px;
      justify-content: flex-start;
    }
    Inside are 4 boxes, each 50px wide (no margins).
  15. 15.🎯 Which CSS selector matches this element?
    <li class="red" id="top">Hello</li>
    (a) .red (b) .top (c) #intro (d) .box
  16. 16.🖌️ How big is the text, in px?
    li {
      font-size: 16px;
      text-align: left;
      color: green;
      background-color: white;
    }
  17. 17.⚖️ What colour is the text of this element?
    <h1 class="star" id="logo">Hi</h1>
    CSS:
    .star { color: purple; }
    .star { color: blue; }
    (a) green (b) red (c) blue (d) purple
  18. 18.🌈 Which colour of light is strongest in rgb(66, 58, 240)? (a) red (b) green (c) blue
  19. 19.🌈 Which colour is #ff0000? (a) yellow (b) red (c) bright green (d) white
  20. 20.✍️ What is the selector in this CSS rule?
    p {
      padding: 8px;
      background-color: yellow;
      font-size: 20px;
      border: 2px solid;
    }
    (a) yellow (b) .note (c) p (d) padding
  21. 21.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 4 (b) 6 (c) 3 (d) 2
  22. 22.🎯 What kind of selector is li? (a) a class selector (b) an id selector (c) an element selector
  23. 23.🖌️ Where does the text sit on its line?
    h1 {
      background-color: blue;
      color: orange;
      text-align: right;
      font-size: 20px;
    }
    (a) on the left (b) in the middle (c) on the right
  24. 24.🖌️ What colour are the letters?
    p {
      background-color: blue;
      font-size: 24px;
      text-align: center;
      color: purple;
    }
    (a) purple (b) black (c) blue
  25. 25.✍️ What is the selector in this CSS rule?
    body {
      text-align: center;
      width: 300px;
    }
    (a) 300px (b) .box (c) text-align (d) body
  26. 26.💪 Which flexbox property turns on flexbox? (a) align-items (b) justify-content (c) flex-direction (d) display: flex
  27. 27.📱 The screen is 540px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 14px;
      }
    }
    (a) No (b) Yes
  28. 28.🖌️ How big is the text, in px?
    li {
      background-color: yellow;
      color: black;
      font-size: 24px;
      text-align: left;
    }
  29. 29.🎯 Which CSS selector matches this element?
    <h1 class="big" id="end">Hello</h1>
    (a) #end (b) .red (c) h2 (d) #hero
  30. 30.🌈 Which hex code is yellow? (a) #00ffff (b) #ffffff (c) #0000ff (d) #ffff00
  31. 31.🖌️ Which CSS property picks the font style? (a) font-family (b) background-color (c) font-weight (d) color
  32. 32.✍️ Which sign goes between a property and its value? (a) ; (b) : (c) - (d) =
  33. 33.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 140px;
      justify-content: space-between;
    }
    Inside are 2 boxes, each 60px wide (no margins).
  34. 34.🎯 Which element does the selector .menu style? (a) <li class="big"> (b) <h2 class="note"> (c) <h2 class="menu"> (d) <h2 id="menu">
  35. 35.What does justify-content: flex-end do? (a) puts boxes in the middle (b) packs boxes at the start (c) equal gaps, none at ends (d) packs boxes at the end
  36. 36.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 110px;
      padding: 20px;
      border: 2px solid black;
      margin: 10px;
    }
  37. 37.💪 Which justify-content value puts boxes in the middle? (a) flex-end (b) center (c) space-between (d) flex-start
  38. 38.📦 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: 25px;
      border: 2px solid black;
      margin: 10px;
    }
  39. 39.🔍 Which is the odd one out? (a) lays out the page (b) changes the text size (c) makes headings and lists (d) sets colours and fonts
  40. 40.🖌️ Where does the text sit on its line?
    li {
      color: white;
      font-size: 24px;
      text-align: center;
      background-color: red;
    }
    (a) in the middle (b) on the left (c) on the right

Answer key

  1. F
  2. .
  3. center
  4. False
  5. reacts to a button click
  6. in the middle
  7. 286
  8. 1
  9. puts boxes in the middle
  10. align-items
  11. 600px or narrower
  12. yellow
  13. purple
  14. 80
  15. .red
  16. 16
  17. blue
  18. blue
  19. red
  20. p
  21. 3
  22. an element selector
  23. on the right
  24. purple
  25. body
  26. display: flex
  27. Yes
  28. 24
  29. #end
  30. #ffff00
  31. font-family
  32. :
  33. 20
  34. <h2 class="menu">
  35. packs boxes at the end
  36. 174
  37. center
  38. 284
  39. makes headings and lists
  40. in the middle

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