← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 271 · 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 black? (a) #00ffff (b) #00ff00 (c) #ff0000 (d) #000000
  2. 2.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 28px;
      }
    }
    (a) Yes (b) No
  3. 3.✍️ Which property is set to 10px in this rule?
    p {
      text-align: center;
      font-weight: bold;
      margin: 10px;
    }
    (a) padding (b) font-weight (c) 10px (d) margin
  4. 4.🎯 Which element does the selector h2 style? (a) <div class="box"> (b) <h2 class="box"> (c) <span id="logo"> (d) <li>
  5. 5.🌈 Which colour is #ff0000? (a) yellow (b) red (c) white (d) magenta
  6. 6.✍️ Which sign ends each CSS declaration? (a) , (b) : (c) . (d) ;
  7. 7.True or false: JavaScript lays out the page. (a) False (b) True
  8. 8.🖌️ How big is the text, in px?
    h1 {
      background-color: black;
      font-size: 32px;
      text-align: left;
      color: orange;
    }
  9. 9.🌈 Which hex code is cyan? (a) #ffff00 (b) #ffffff (c) #00ff00 (d) #00ffff
  10. 10.🎯 Which sign starts a class selector? (a) @ (b) . (c) & (d) #
  11. 11.⚖️ What colour is the text of this element?
    <p class="menu" id="intro">Hi</p>
    CSS:
    .menu { color: purple; }
    .menu { color: white; }
    (a) orange (b) white (c) purple (d) blue
  12. 12.🖌️ Which CSS property colours behind the text? (a) color (b) text-align (c) font-family (d) background-color
  13. 13.True or false: body is an element selector. (a) False (b) True
  14. 14.🌈 Which colour is rgb(255, 255, 0)? (a) yellow (b) cyan (c) red (d) bright green
  15. 15.⚖️ What colour is the text of this element?
    <h1 class="red" id="top">Hi</h1>
    CSS:
    h1 { color: purple; }
    .red { color: white; }
    #top { color: blue; }
    (a) yellow (b) white (c) blue (d) purple
  16. 16.What does justify-content: space-between do? (a) packs boxes at the end (b) equal gaps, none at ends (c) puts boxes in the middle (d) packs boxes at the start
  17. 17.🔍 Which is the odd one out? (a) changes the text size (b) adds space around boxes (c) sets colours and fonts (d) puts a picture on a page
  18. 18.🎯 Which CSS selector matches this element?
    <h2 class="star" id="top">Hello</h2>
    (a) li (b) #intro (c) h2 (d) .menu
  19. 19.✍️ How many declarations (property: value pairs) are in this rule?
    #top {
      font-size: 20px;
    }
  20. 20.🌈 In #000043 the blue part is the hex number 43. What is it as a normal number?
  21. 21.🧩 Which language checks a quiz answer? (a) CSS (b) HTML (c) JavaScript
  22. 22.True or false: CSS makes headings and lists. (a) False (b) True
  23. 23.⚖️ What colour is the text of this element?
    <p class="star" id="intro">Hi</p>
    CSS:
    .star { color: red; }
    p { color: blue; }
    #intro { color: black; }
    (a) red (b) blue (c) orange (d) black
  24. 24.🔍 Which is the odd one out? (a) checks a quiz answer (b) makes a form box (c) shows a pop-up message (d) reacts to a button click
  25. 25.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 16px;
      }
    }
    (a) Yes (b) No
  26. 26.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 8px;
      }
    }
  27. 27.⚖️ What colour is the text of this element?
    <p class="red" id="intro">Hi</p>
    CSS:
    #intro { color: black; }
    p { color: green; }
    .red { color: orange; }
    (a) green (b) red (c) black (d) orange
  28. 28.What does color do? (a) makes letters bigger (b) centres a heading (c) sets the letter colour (d) colours behind the text
  29. 29.⚖️ What colour is the text of this element?
    <p class="menu" id="top">Hi</p>
    CSS:
    #top { color: purple; }
    p { color: red; }
    (a) purple (b) white (c) red (d) green
  30. 30.True or false: p is an id selector. (a) True (b) False
  31. 31.🎯 Which CSS selector matches this element?
    <div class="star" id="hero">Hello</div>
    (a) div (b) .hero (c) span (d) #top
  32. 32.🎯 Which element does the selector h1 style? (a) <h1 class="star"> (b) <li class="star"> (c) <h2> (d) <div id="main">
  33. 33.🌈 Which hex code is bright green? (a) #000000 (b) #ff0000 (c) #00ff00 (d) #ffffff
  34. 34.🌈 Which colour is #00ffff? (a) cyan (b) red (c) blue (d) yellow
  35. 35.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 170px;
      justify-content: flex-end;
    }
    Inside are 2 boxes, each 80px wide (no margins).
  36. 36.📱 The screen is 540px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 18px;
      }
    }
    (a) No (b) Yes
  37. 37.True or false: .note is an id selector. (a) True (b) False
  38. 38.✍️ What is the selector in this CSS rule?
    li {
      padding: 8px;
      width: 300px;
      margin: 10px;
    }
    (a) 300px (b) body (c) padding (d) li
  39. 39.🌈 Which colour is rgb(0, 0, 0)? (a) white (b) black (c) yellow (d) bright green
  40. 40.🧩 Which language rounds box corners? (a) JavaScript (b) HTML (c) CSS

Answer key

  1. #000000
  2. No
  3. margin
  4. <h2 class="box">
  5. red
  6. ;
  7. False
  8. 32
  9. #00ffff
  10. .
  11. white
  12. background-color
  13. True
  14. yellow
  15. blue
  16. equal gaps, none at ends
  17. puts a picture on a page
  18. h2
  19. 1
  20. 67
  21. JavaScript
  22. False
  23. black
  24. makes a form box
  25. Yes
  26. 12
  27. black
  28. sets the letter colour
  29. purple
  30. False
  31. div
  32. <h1 class="star">
  33. #00ff00
  34. cyan
  35. 10
  36. No
  37. False
  38. li
  39. black
  40. CSS

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