← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 117 · 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.🌈 In #rrggbb, which colour do the last two digits give? (a) red (b) white (c) blue (d) green
  2. 2.🖌️ What colour are the letters?
    p {
      color: green;
      text-align: center;
      background-color: orange;
      font-size: 20px;
    }
    (a) orange (b) green (c) red
  3. 3.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 190px;
      padding: 15px;
      border: 1px solid black;
      margin: 10px;
    }
  4. 4.✍️ Which sign ends each CSS declaration? (a) . (b) ; (c) : (d) ,
  5. 5.True or false: CSS makes a form box. (a) False (b) True
  6. 6.🌈 Which hex code is bright green? (a) #000000 (b) #0000ff (c) #00ff00 (d) #ff0000
  7. 7.True or false: body is an element selector. (a) True (b) False
  8. 8.🖌️ What colour is behind the letters?
    h2 {
      font-size: 36px;
      background-color: orange;
      color: red;
      text-align: left;
    }
    (a) orange (b) red (c) yellow
  9. 9.Which of these does HTML do? (a) rounds box corners (b) puts a picture on a page (c) adds space around boxes (d) changes the text size
  10. 10.🎯 Which element does the selector div style? (a) <span> (b) <div class="big"> (c) <p class="big"> (d) <h1 id="main">
  11. 11.🎯 Which CSS selector matches this element?
    <div class="box" id="logo">Hello</div>
    (a) .star (b) #box (c) #logo (d) #end
  12. 12.⚖️ What colour is the text of this element?
    <p class="box" id="top">Hi</p>
    CSS:
    #top { color: purple; }
    p { color: green; }
    .box { color: black; }
    (a) green (b) purple (c) black (d) blue
  13. 13.🎯 Which CSS selector matches this element?
    <h2 class="box" id="intro">Hello</h2>
    (a) #main (b) .star (c) li (d) h2
  14. 14.Which of these is the border? (a) space outside the border (b) the text or picture (c) a solid or dotted edge (d) the gap round content
  15. 15.📱 The screen is 540px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 16px;
      }
    }
    (a) Yes (b) No
  16. 16.Which of these does HTML do? (a) reacts to a button click (b) adds space around boxes (c) makes a form box (d) lays out the page
  17. 17.🌈 Which colour of light is strongest in rgb(251, 77, 88)? (a) red (b) green (c) blue
  18. 18.🌈 In #000089 the blue part is the hex number 89. What is it as a normal number?
  19. 19.🌈 Which colour is #00ffff? (a) magenta (b) red (c) cyan (d) white
  20. 20.🧩 Which language puts a picture on a page? (a) JavaScript (b) CSS (c) HTML
  21. 21.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 110px;
      padding: 25px;
      border: 3px solid black;
      margin: 15px;
    }
  22. 22.🌈 What is the biggest number one colour can have in rgb()? (a) 100 (b) 1000 (c) 99 (d) 255
  23. 23.🎯 Which CSS selector matches this element?
    <li class="menu" id="main">Hello</li>
    (a) .note (b) #menu (c) li (d) .main
  24. 24.🌈 Which colour is rgb(255, 0, 0)? (a) red (b) black (c) white (d) yellow
  25. 25.True or false: JavaScript makes headings and lists. (a) False (b) True
  26. 26.🌈 Which colour of light is strongest in rgb(248, 135, 110)? (a) green (b) red (c) blue
  27. 27.✍️ Which property is set to 8px in this rule?
    body {
      padding: 8px;
      font-weight: bold;
      font-size: 20px;
      border: 2px solid;
    }
    (a) font-weight (b) 8px (c) border (d) padding
  28. 28.💪 Which justify-content value packs boxes at the end? (a) flex-start (b) space-between (c) flex-end (d) center
  29. 29.🎨 Which attribute adds CSS inside one tag? (a) style (b) href (c) alt (d) src
  30. 30.🎯 Which element does the selector .menu style? (a) <li class="menu"> (b) <li id="menu"> (c) <li class="note"> (d) <div class="big">
  31. 31.✍️ CSS declarations go inside which brackets? (a) ( ) (b) < > (c) { } (d) [ ]
  32. 32.True or false: CSS checks a quiz answer. (a) False (b) True
  33. 33.📱 Responsive design means a page ___. (a) is only for laptops (b) fits every screen (c) never changes (d) has no pictures
  34. 34.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 70px;
      padding: 30px;
      border: 5px solid black;
      margin: 0px;
    }
  35. 35.⚖️ What colour is the text of this element?
    <p class="menu" id="logo">Hi</p>
    CSS:
    .menu { color: white; }
    .menu { color: purple; }
    (a) green (b) white (c) black (d) purple
  36. 36.💪 Which justify-content value equal gaps, none at ends? (a) flex-start (b) center (c) flex-end (d) space-between
  37. 37.✍️ How many declarations (property: value pairs) are in this rule?
    .note {
      background-color: yellow;
    }
  38. 38.🔍 Which is the odd one out? (a) gives the page structure (b) adds space around boxes (c) puts a picture on a page (d) makes headings and lists
  39. 39.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 130px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 40px wide (no margins).
  40. 40.🔍 Which is the odd one out? (a) makes a form box (b) makes headings and lists (c) changes the text size (d) puts a picture on a page

Answer key

  1. blue
  2. green
  3. 242
  4. ;
  5. False
  6. #00ff00
  7. True
  8. orange
  9. puts a picture on a page
  10. <div class="big">
  11. #logo
  12. purple
  13. h2
  14. a solid or dotted edge
  15. No
  16. makes a form box
  17. red
  18. 137
  19. cyan
  20. HTML
  21. 196
  22. 255
  23. li
  24. red
  25. False
  26. red
  27. padding
  28. flex-end
  29. style
  30. <li class="menu">
  31. { }
  32. False
  33. fits every screen
  34. 140
  35. purple
  36. space-between
  37. 1
  38. adds space around boxes
  39. 50
  40. changes the text size

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