← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 632 · 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.⚖️ What colour is the text of this element?
    <p class="box" id="main">Hi</p>
    CSS:
    .box { color: white; }
    p { color: green; }
    (a) orange (b) red (c) white (d) green
  2. 2.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 80px;
      padding: 25px;
      border: 4px solid black;
      margin: 10px;
    }
  3. 3.What does justify-content: flex-end do? (a) equal gaps, none at ends (b) puts boxes in the middle (c) packs boxes at the start (d) packs boxes at the end
  4. 4.What does justify-content: flex-start do? (a) packs boxes at the start (b) equal gaps, none at ends (c) puts boxes in the middle (d) packs boxes at the end
  5. 5.🧩 Which language reacts to a button click? (a) HTML (b) CSS (c) JavaScript
  6. 6.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 50px;
      padding: 20px;
      border: 4px solid black;
      margin: 5px;
    }
  7. 7.🌈 In #00c500 the green part is the hex number c5. What is it as a normal number?
  8. 8.📦 In the box model, which part is the gap round content? (a) border (b) padding (c) margin (d) content
  9. 9.✍️ In color: blue; which part is the value? (a) blue (b) ; (c) : (d) color
  10. 10.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 170px;
      padding: 10px;
      border: 1px solid black;
      margin: 20px;
    }
  11. 11.🌈 Which colour is rgb(255, 0, 0)? (a) red (b) blue (c) magenta (d) bright green
  12. 12.🎯 Which element does the selector p style? (a) <li id="end"> (b) <h2 class="box"> (c) <p class="box"> (d) <h1>
  13. 13.Which of these is padding? (a) space outside the border (b) the text or picture (c) the gap round content (d) the line round the box
  14. 14.🖌️ How big is the text, in px?
    li {
      color: white;
      font-size: 36px;
      background-color: red;
      text-align: left;
    }
  15. 15.True or false: HTML rounds box corners. (a) True (b) False
  16. 16.⚖️ What colour is the text of this element?
    <p class="menu" id="intro">Hi</p>
    CSS:
    #intro { color: orange; }
    .menu { color: purple; }
    p { color: green; }
    (a) orange (b) blue (c) green (d) purple
  17. 17.🔍 Which is the odd one out? (a) puts a picture on a page (b) reacts to a button click (c) makes headings and lists (d) gives the page structure
  18. 18.🎯 Which element does the selector .box style? (a) <p class="box"> (b) <h1 class="menu"> (c) <p id="box"> (d) <p class="star">
  19. 19.🎯 Which element does the selector #logo style? (a) <h1 class="logo"> (b) <h1 id="end"> (c) <h2 class="box"> (d) <h1 id="logo">
  20. 20.🌈 Which colour is rgb(255, 255, 255)? (a) yellow (b) red (c) blue (d) white
  21. 21.✍️ Which property is set to 300px in this rule?
    li {
      width: 300px;
      font-style: italic;
    }
    (a) 300px (b) color (c) font-style (d) width
  22. 22.✍️ Which sign goes between a property and its value? (a) - (b) : (c) = (d) ;
  23. 23.🌈 Hex digits go 0 to 9, then A to which letter? (a) F (b) J (c) Z (d) G
  24. 24.🌈 In #rrggbb, which colour do the last two digits give? (a) white (b) red (c) blue (d) green
  25. 25.🌈 In #004100 the green part is the hex number 41. What is it as a normal number?
  26. 26.🖌️ Where does the text sit on its line?
    li {
      text-align: left;
      background-color: green;
      font-size: 36px;
      color: purple;
    }
    (a) in the middle (b) on the right (c) on the left
  27. 27.⚖️ What colour is the text of this element?
    <p class="red" id="hero">Hi</p>
    CSS:
    p { color: purple; }
    p { color: green; }
    (a) yellow (b) blue (c) purple (d) green
  28. 28.True or false: margin is the gap round content. (a) False (b) True
  29. 29.🖌️ What colour are the letters?
    li {
      color: black;
      background-color: blue;
      text-align: right;
      font-size: 40px;
    }
    (a) black (b) blue (c) green
  30. 30.🖌️ Where does the text sit on its line?
    li {
      color: black;
      font-size: 32px;
      text-align: right;
      background-color: green;
    }
    (a) on the left (b) in the middle (c) on the right
  31. 31.📦 In the box model, which part is space inside the border? (a) content (b) margin (c) padding (d) border
  32. 32.🖌️ What colour are the letters?
    h2 {
      text-align: right;
      font-size: 20px;
      background-color: orange;
      color: green;
    }
    (a) purple (b) orange (c) green
  33. 33.📱 What does a media query check? (a) the time of day (b) the battery level (c) the screen width (d) the page title
  34. 34.🎯 How many elements on a page should have the same id? (a) 2 (b) 5 (c) any number (d) 1
  35. 35.🖌️ Which CSS property centres a heading? (a) font-size (b) font-family (c) text-align (d) color
  36. 36.✍️ In color: blue; which part is the property? (a) ; (b) color (c) blue (d) :
  37. 37.🌈 Which colour of light is strongest in rgb(125, 105, 211)? (a) green (b) blue (c) red
  38. 38.What does font-weight do? (a) picks the font style (b) makes letters bigger (c) centres a heading (d) makes the text bold
  39. 39.📱 max-width: 600px applies when the screen is ___. (a) turned off (b) 600px or wider (c) 600px or narrower (d) exactly 1000px
  40. 40.Which of these does CSS do? (a) lays out the page (b) makes a link (c) makes headings and lists (d) reacts to a button click

Answer key

  1. white
  2. 138
  3. packs boxes at the end
  4. packs boxes at the start
  5. JavaScript
  6. 108
  7. 197
  8. padding
  9. blue
  10. 232
  11. red
  12. <p class="box">
  13. the gap round content
  14. 36
  15. False
  16. orange
  17. reacts to a button click
  18. <p class="box">
  19. <h1 id="logo">
  20. white
  21. width
  22. :
  23. F
  24. blue
  25. 65
  26. on the left
  27. green
  28. False
  29. black
  30. on the right
  31. padding
  32. green
  33. the screen width
  34. 1
  35. text-align
  36. color
  37. blue
  38. makes the text bold
  39. 600px or narrower
  40. lays out the page

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