← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 251 · 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 big is the text, in px?
    h2 {
      background-color: blue;
      font-size: 36px;
      text-align: left;
      color: black;
    }
  2. 2.🎨 Which attribute adds CSS inside one tag? (a) alt (b) src (c) href (d) style
  3. 3.🎯 Which element does the selector span style? (a) <span class="note"> (b) <p> (c) <h2 id="intro"> (d) <h1 class="note">
  4. 4.What does justify-content: center do? (a) puts boxes in the middle (b) equal gaps, none at ends (c) packs boxes at the end (d) packs boxes at the start
  5. 5.🌈 What is the biggest number one colour can have in rgb()? (a) 100 (b) 99 (c) 1000 (d) 255
  6. 6.🖌️ Which CSS property picks the font style? (a) font-size (b) font-family (c) background-color (d) text-align
  7. 7.🎯 Which CSS selector matches this element?
    <div class="note" id="hero">Hello</div>
    (a) span (b) div (c) #note (d) #top
  8. 8.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 130px;
      padding: 30px;
      border: 3px solid black;
      margin: 20px;
    }
  9. 9.🌈 Which hex code is blue? (a) #ffff00 (b) #0000ff (c) #ffffff (d) #000000
  10. 10.📱 min-width: 800px applies when the screen is ___. (a) 800px or wider (b) 800px or narrower (c) exactly 100px (d) turned off
  11. 11.True or false: .card is an id selector. (a) True (b) False
  12. 12.What does font-weight do? (a) colours behind the text (b) makes letters bigger (c) makes the text bold (d) sets the letter colour
  13. 13.✍️ How many declarations (property: value pairs) are in this rule?
    p {
      text-align: center;
    }
  14. 14.💪 Which flexbox property spaces boxes along a row? (a) justify-content (b) align-items (c) display: flex (d) gap
  15. 15.🔍 Which is the odd one out? (a) counts down a timer (b) changes the page live (c) makes a form box (d) reacts to a button click
  16. 16.Which of these does CSS do? (a) makes a form box (b) puts a picture on a page (c) makes a link (d) sets colours and fonts
  17. 17.📱 max-width: 600px applies when the screen is ___. (a) 600px or narrower (b) exactly 1000px (c) 600px or wider (d) turned off
  18. 18.True or false: padding is a solid or dotted edge. (a) False (b) True
  19. 19.⚖️ What colour is the text of this element?
    <p class="box" id="end">Hi</p>
    CSS:
    p { color: green; }
    p { color: red; }
    (a) black (b) blue (c) red (d) green
  20. 20.⚖️ What colour is the text of this element?
    <p class="big" id="main">Hi</p>
    CSS:
    p { color: black; }
    p { color: yellow; }
    (a) purple (b) red (c) yellow (d) black
  21. 21.✍️ Which sign ends each CSS declaration? (a) : (b) , (c) . (d) ;
  22. 22.🎯 What kind of selector is .note? (a) an id selector (b) a class selector (c) an element selector
  23. 23.✍️ Which sign goes between a property and its value? (a) : (b) - (c) ; (d) =
  24. 24.🎯 Can many elements share the same class? (a) No (b) Yes
  25. 25.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 160px;
      padding: 25px;
      border: 3px solid black;
      margin: 5px;
    }
  26. 26.🌈 Which colour is #0000ff? (a) black (b) blue (c) yellow (d) white
  27. 27.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 70px;
      padding: 25px;
      border: 3px solid black;
      margin: 0px;
    }
  28. 28.True or false: p is an element selector. (a) True (b) False
  29. 29.🌈 Which colour is rgb(255, 255, 0)? (a) cyan (b) red (c) black (d) yellow
  30. 30.🎯 Which sign starts an id selector? (a) . (b) & (c) # (d) @
  31. 31.📱 Responsive design means a page ___. (a) is only for laptops (b) fits every screen (c) never changes (d) has no pictures
  32. 32.🧩 Which language shows a pop-up message? (a) JavaScript (b) HTML (c) CSS
  33. 33.🖌️ Which CSS property colours behind the text? (a) text-align (b) font-size (c) color (d) background-color
  34. 34.🧩 Which language makes a link? (a) CSS (b) HTML (c) JavaScript
  35. 35.💪 Which justify-content value equal gaps, none at ends? (a) center (b) space-between (c) flex-end (d) flex-start
  36. 36.🌈 In #rrggbb, which colour do the last two digits give? (a) green (b) white (c) red (d) blue
  37. 37.🖌️ What colour are the letters?
    h2 {
      background-color: yellow;
      font-size: 20px;
      text-align: left;
      color: white;
    }
    (a) yellow (b) green (c) white
  38. 38.True or false: the border is the line round the box. (a) False (b) True
  39. 39.💪 Which justify-content value packs boxes at the end? (a) flex-start (b) flex-end (c) center (d) space-between
  40. 40.🖌️ What colour are the letters?
    li {
      color: white;
      background-color: yellow;
      text-align: center;
      font-size: 20px;
    }
    (a) white (b) yellow (c) black

Answer key

  1. 36
  2. style
  3. <span class="note">
  4. puts boxes in the middle
  5. 255
  6. font-family
  7. div
  8. 196
  9. #0000ff
  10. 800px or wider
  11. False
  12. makes the text bold
  13. 1
  14. justify-content
  15. makes a form box
  16. sets colours and fonts
  17. 600px or narrower
  18. False
  19. red
  20. yellow
  21. ;
  22. a class selector
  23. :
  24. Yes
  25. 226
  26. blue
  27. 126
  28. True
  29. yellow
  30. #
  31. fits every screen
  32. JavaScript
  33. background-color
  34. HTML
  35. space-between
  36. blue
  37. white
  38. True
  39. flex-end
  40. white

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