← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 746 · 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 hex code is cyan? (a) #000000 (b) #ffff00 (c) #00ff00 (d) #00ffff
  2. 2.💪 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).
  3. 3.📦 In the box model, which part is the gap to other boxes? (a) content (b) border (c) margin (d) padding
  4. 4.🔍 Which is the odd one out? (a) checks a quiz answer (b) shows a pop-up message (c) adds space around boxes (d) changes the page live
  5. 5.💪 Which justify-content value packs boxes at the end? (a) flex-end (b) space-between (c) center (d) flex-start
  6. 6.🖌️ What colour is behind the letters?
    p {
      font-size: 32px;
      text-align: left;
      color: yellow;
      background-color: black;
    }
    (a) black (b) yellow (c) green
  7. 7.🎯 What kind of selector is p? (a) a class selector (b) an element selector (c) an id selector
  8. 8.🎯 Which CSS selector matches this element?
    <li class="big" id="top">Hello</li>
    (a) #big (b) .big (c) .top (d) div
  9. 9.🎯 Which element does the selector #logo style? (a) <h1 class="box"> (b) <p class="logo"> (c) <p id="end"> (d) <p id="logo">
  10. 10.🖌️ What colour are the letters?
    p {
      text-align: left;
      font-size: 40px;
      background-color: blue;
      color: green;
    }
    (a) green (b) red (c) blue
  11. 11.🌈 In #rrggbb, which colour do the last two digits give? (a) white (b) blue (c) red (d) green
  12. 12.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 230px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 100px wide (no margins).
  13. 13.⚖️ What colour is the text of this element?
    <p class="red" id="hero">Hi</p>
    CSS:
    p { color: white; }
    .red { color: blue; }
    #hero { color: purple; }
    (a) white (b) purple (c) red (d) blue
  14. 14.📱 The screen is 414px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 18px;
      }
    }
    (a) No (b) Yes
  15. 15.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 20px;
      }
    }
  16. 16.✍️ What value is given to text-align in this rule?
    #top {
      text-align: center;
      padding: 8px;
    }
    (a) text-align (b) center (c) yellow (d) 10px
  17. 17.🖌️ Which CSS property picks the font style? (a) background-color (b) font-size (c) text-align (d) font-family
  18. 18.⚖️ What colour is the text of this element?
    <h1 class="box" id="main">Hi</h1>
    CSS:
    .box { color: white; }
    .box { color: purple; }
    (a) yellow (b) black (c) white (d) purple
  19. 19.🌈 Hex digits go 0 to 9, then A to which letter? (a) J (b) Z (c) G (d) F
  20. 20.🎯 What kind of selector is #main? (a) an element selector (b) an id selector (c) a class selector
  21. 21.🌈 In #rrggbb, which colour do the first two digits give? (a) green (b) blue (c) black (d) red
  22. 22.🔍 Which is the odd one out? (a) puts a picture on a page (b) makes a form box (c) shows a pop-up message (d) makes a link
  23. 23.🎨 One CSS file can style how many pages? (a) only one word (b) no pages (c) only one image (d) many pages
  24. 24.🎯 Which element does the selector #intro style? (a) <h2 class="intro"> (b) <h2 id="main"> (c) <li class="note"> (d) <h2 id="intro">
  25. 25.🎯 Which CSS selector matches this element?
    <p class="box" id="top">Hello</p>
    (a) #box (b) .star (c) .top (d) .box
  26. 26.⚖️ What colour is the text of this element?
    <p class="star" id="hero">Hi</p>
    CSS:
    #hero { color: orange; }
    #hero { color: black; }
    (a) black (b) red (c) orange (d) yellow
  27. 27.✍️ How many declarations (property: value pairs) are in this rule?
    li {
      background-color: yellow;
      font-size: 20px;
      font-weight: bold;
      color: red;
    }
  28. 28.📱 Responsive design means a page ___. (a) never changes (b) fits every screen (c) is only for laptops (d) has no pictures
  29. 29.✍️ Which property is set to 8px in this rule?
    h2 {
      background-color: yellow;
      padding: 8px;
      font-style: italic;
      font-weight: bold;
    }
    (a) border (b) font-weight (c) padding (d) 8px
  30. 30.✍️ In color: blue; which part is the value? (a) ; (b) color (c) blue (d) :
  31. 31.📱 min-width: 800px applies when the screen is ___. (a) turned off (b) 800px or wider (c) 800px or narrower (d) exactly 100px
  32. 32.🧩 Which language checks a quiz answer? (a) HTML (b) JavaScript (c) CSS
  33. 33.Which of these does CSS do? (a) shows a pop-up message (b) makes a form box (c) rounds box corners (d) makes a link
  34. 34.🎯 Which element does the selector #main style? (a) <span class="main"> (b) <p class="big"> (c) <span id="main"> (d) <span id="logo">
  35. 35.🧩 Which language reacts to a button click? (a) CSS (b) JavaScript (c) HTML
  36. 36.🎯 Which CSS selector matches this element?
    <h2 class="red" id="end">Hello</h2>
    (a) li (b) #hero (c) h2 (d) .box
  37. 37.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 300px;
      padding: 25px;
      border: 3px solid black;
      margin: 20px;
    }
  38. 38.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 26px;
      }
    }
  39. 39.🌈 In #350000 the red part is the hex number 35. What is it as a normal number?
  40. 40.💪 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).

Answer key

  1. #00ffff
  2. 80
  3. margin
  4. adds space around boxes
  5. flex-end
  6. black
  7. an element selector
  8. .big
  9. <p id="logo">
  10. green
  11. blue
  12. 30
  13. purple
  14. Yes
  15. 24
  16. center
  17. font-family
  18. purple
  19. F
  20. an id selector
  21. red
  22. shows a pop-up message
  23. many pages
  24. <h2 id="intro">
  25. .box
  26. black
  27. 4
  28. fits every screen
  29. padding
  30. blue
  31. 800px or wider
  32. JavaScript
  33. rounds box corners
  34. <span id="main">
  35. JavaScript
  36. h2
  37. 356
  38. 24
  39. 53
  40. 50

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