← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 950 · 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.🌈 Which colour of light is strongest in rgb(91, 52, 215)? (a) red (b) blue (c) green
  2. 2.Which of these does HTML do? (a) adds space around boxes (b) makes a link (c) reacts to a button click (d) sets colours and fonts
  3. 3.🎯 Can many elements share the same class? (a) Yes (b) No
  4. 4.🖌️ Which CSS property picks the font style? (a) font-family (b) text-align (c) color (d) background-color
  5. 5.🖌️ What colour are the letters?
    h2 {
      background-color: green;
      font-size: 36px;
      color: black;
      text-align: right;
    }
    (a) black (b) green (c) blue
  6. 6.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 26px;
      }
    }
  7. 7.✍️ How many declarations (property: value pairs) are in this rule?
    p {
      text-align: center;
    }
  8. 8.🧩 Which language shows a pop-up message? (a) JavaScript (b) HTML (c) CSS
  9. 9.🔍 Which is the odd one out? (a) adds space around boxes (b) rounds box corners (c) shows a pop-up message (d) lays out the page
  10. 10.⚖️ What colour is the text of this element?
    <h2 class="note" id="main">Hi</h2>
    CSS:
    #main { color: purple; }
    h2 { color: green; }
    (a) purple (b) yellow (c) black (d) green
  11. 11.🔍 Which is the odd one out? (a) shows a pop-up message (b) changes the page live (c) lays out the page (d) checks a quiz answer
  12. 12.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 130px;
      justify-content: flex-end;
    }
    Inside are 3 boxes, each 40px wide (no margins).
  13. 13.🌈 In #0000e4 the blue part is the hex number e4. What is it as a normal number?
  14. 14.True or false: margin is space outside the border. (a) False (b) True
  15. 15.Which of these does HTML do? (a) puts a picture on a page (b) lays out the page (c) changes the text size (d) adds space around boxes
  16. 16.💪 Which justify-content value equal gaps, none at ends? (a) flex-start (b) center (c) flex-end (d) space-between
  17. 17.🖌️ How big is the text, in px?
    h1 {
      color: yellow;
      text-align: right;
      background-color: orange;
      font-size: 20px;
    }
  18. 18.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the shorter one (b) the later one (c) neither (d) the first one
  19. 19.✍️ Which property is set to yellow in this rule?
    p {
      background-color: yellow;
      color: red;
      margin: 10px;
    }
    (a) margin (b) background-color (c) padding (d) yellow
  20. 20.🎯 Which element does the selector #top style? (a) <p id="intro"> (b) <p id="top"> (c) <p class="top"> (d) <h1 class="box">
  21. 21.🎯 How many elements on a page should have the same id? (a) 2 (b) 5 (c) 1 (d) any number
  22. 22.🎯 Which CSS selector matches this element?
    <p class="star" id="end">Hello</p>
    (a) .end (b) #hero (c) #star (d) #end
  23. 23.✍️ In color: blue; which part is the property? (a) : (b) blue (c) color (d) ;
  24. 24.True or false: CSS makes headings and lists. (a) False (b) True
  25. 25.🎯 Which sign starts an id selector? (a) & (b) @ (c) . (d) #
  26. 26.🎨 Which tag connects an outside CSS file? (a) <img> (b) <css> (c) <a> (d) <link>
  27. 27.Which of these is padding? (a) the gap to other boxes (b) space inside the border (c) space outside the border (d) the text or picture
  28. 28.🎯 Which CSS selector matches this element?
    <h2 class="star" id="main">Hello</h2>
    (a) li (b) .main (c) #main (d) #star
  29. 29.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 170px;
      padding: 10px;
      border: 4px solid black;
      margin: 5px;
    }
  30. 30.🖌️ What colour is behind the letters?
    h2 {
      text-align: center;
      color: purple;
      background-color: yellow;
      font-size: 24px;
    }
    (a) yellow (b) blue (c) purple
  31. 31.🌈 In #000079 the blue part is the hex number 79. What is it as a normal number?
  32. 32.⚖️ What colour is the text of this element?
    <p class="red" id="top">Hi</p>
    CSS:
    #top { color: red; }
    #top { color: yellow; }
    (a) red (b) black (c) yellow (d) green
  33. 33.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 280px;
      justify-content: flex-end;
    }
    Inside are 4 boxes, each 50px wide (no margins).
  34. 34.🎯 Which element does the selector #logo style? (a) <p class="logo"> (b) <p id="end"> (c) <p id="logo"> (d) <h1 class="red">
  35. 35.What does font-family do? (a) centres a heading (b) colours behind the text (c) makes letters bigger (d) picks the font style
  36. 36.✍️ Which sign ends each CSS declaration? (a) : (b) ; (c) , (d) .
  37. 37.🎨 Which tag holds CSS inside the head? (a) <body> (b) <script> (c) <css> (d) <style>
  38. 38.🌈 Which colour is rgb(0, 255, 0)? (a) blue (b) black (c) white (d) bright green
  39. 39.🎯 Which element does the selector .big style? (a) <h1 class="box"> (b) <p id="big"> (c) <p class="big"> (d) <p class="red">
  40. 40.🎯 Which element does the selector #intro style? (a) <p id="main"> (b) <p class="intro"> (c) <h1 class="big"> (d) <p id="intro">

Answer key

  1. blue
  2. makes a link
  3. Yes
  4. font-family
  5. black
  6. 24
  7. 1
  8. JavaScript
  9. shows a pop-up message
  10. purple
  11. lays out the page
  12. 10
  13. 228
  14. True
  15. puts a picture on a page
  16. space-between
  17. 20
  18. the later one
  19. background-color
  20. <p id="top">
  21. 1
  22. #end
  23. color
  24. False
  25. #
  26. <link>
  27. space inside the border
  28. #main
  29. 198
  30. yellow
  31. 121
  32. yellow
  33. 80
  34. <p id="logo">
  35. picks the font style
  36. ;
  37. <style>
  38. bright green
  39. <p class="big">
  40. <p id="intro">

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