← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 393 · 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 tag holds CSS inside the head? (a) <css> (b) <script> (c) <style> (d) <body>
  2. 2.📦 In the box model, which part is the line round the box? (a) padding (b) content (c) border (d) margin
  3. 3.✍️ Which property is set to red in this rule?
    h1 {
      text-align: center;
      width: 300px;
      color: red;
    }
    (a) font-size (b) color (c) text-align (d) red
  4. 4.🌈 Which colour of light is strongest in rgb(0, 98, 245)? (a) red (b) green (c) blue
  5. 5.🔍 Which is the odd one out? (a) makes a link (b) changes the text size (c) puts a picture on a page (d) gives the page structure
  6. 6.✍️ What is the selector in this CSS rule?
    .note {
      background-color: yellow;
      margin: 10px;
      color: red;
    }
    (a) 10px (b) #top (c) .note (d) background-color
  7. 7.🖌️ How big is the text, in px?
    h1 {
      background-color: red;
      text-align: right;
      color: black;
      font-size: 36px;
    }
  8. 8.✍️ In color: blue; which part is the property? (a) blue (b) ; (c) : (d) color
  9. 9.What does justify-content: space-between do? (a) packs boxes at the end (b) puts boxes in the middle (c) equal gaps, none at ends (d) packs boxes at the start
  10. 10.📱 The screen is 1366px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 24px;
      }
    }
    (a) Yes (b) No
  11. 11.🧩 Which language makes a form box? (a) JavaScript (b) CSS (c) HTML
  12. 12.🌈 In #000600 the green part is the hex number 06. What is it as a normal number?
  13. 13.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 22px;
      }
    }
    (a) Yes (b) No
  14. 14.📱 The screen is 700px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 28px;
      }
    }
    (a) Yes (b) No
  15. 15.🖌️ Which CSS property makes letters bigger? (a) text-align (b) font-size (c) font-family (d) color
  16. 16.What does justify-content: center do? (a) packs boxes at the start (b) packs boxes at the end (c) equal gaps, none at ends (d) puts boxes in the middle
  17. 17.✍️ How many declarations (property: value pairs) are in this rule?
    .note {
      color: red;
      font-size: 20px;
      font-style: italic;
    }
  18. 18.🌈 In #000400 the green part is the hex number 04. What is it as a normal number?
  19. 19.🎯 Which element does the selector li style? (a) <div> (b) <span class="big"> (c) <p id="intro"> (d) <li class="big">
  20. 20.✍️ Which sign ends each CSS declaration? (a) : (b) ; (c) , (d) .
  21. 21.🎯 Which CSS selector matches this element?
    <li class="menu" id="intro">Hello</li>
    (a) .note (b) #main (c) li (d) #menu
  22. 22.🖌️ What colour are the letters?
    h2 {
      text-align: left;
      background-color: red;
      font-size: 40px;
      color: purple;
    }
    (a) black (b) purple (c) red
  23. 23.🔍 Which is the odd one out? (a) changes the text size (b) counts down a timer (c) adds space around boxes (d) sets colours and fonts
  24. 24.✍️ How many declarations (property: value pairs) are in this rule?
    #top {
      font-weight: bold;
      width: 300px;
      text-align: center;
    }
  25. 25.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 180px;
      padding: 15px;
      border: 1px solid black;
      margin: 20px;
    }
  26. 26.⚖️ What colour is the text of this element?
    <p class="note" id="hero">Hi</p>
    CSS:
    #hero { color: yellow; }
    .note { color: white; }
    p { color: green; }
    (a) green (b) purple (c) yellow (d) white
  27. 27.True or false: CSS gives the page structure. (a) False (b) True
  28. 28.📱 min-width: 800px applies when the screen is ___. (a) 800px or wider (b) 800px or narrower (c) exactly 100px (d) turned off
  29. 29.🖌️ Where does the text sit on its line?
    h1 {
      text-align: center;
      color: blue;
      font-size: 28px;
      background-color: orange;
    }
    (a) on the left (b) in the middle (c) on the right
  30. 30.🌈 Which colour is #ffffff? (a) white (b) yellow (c) magenta (d) bright green
  31. 31.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 280px;
      padding: 20px;
      border: 5px solid black;
      margin: 10px;
    }
  32. 32.🖌️ What colour are the letters?
    p {
      font-size: 12px;
      text-align: left;
      background-color: white;
      color: red;
    }
    (a) red (b) orange (c) white
  33. 33.⚖️ Which selector is the strongest? (a) a class selector (b) an id selector (c) an element selector
  34. 34.⚖️ What colour is the text of this element?
    <h2 class="star" id="hero">Hi</h2>
    CSS:
    .star { color: yellow; }
    #hero { color: red; }
    (a) blue (b) red (c) yellow (d) black
  35. 35.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 230px;
      justify-content: space-between;
    }
    Inside are 2 boxes, each 100px wide (no margins).
  36. 36.🎯 Which element does the selector .big style? (a) <span class="box"> (b) <div id="big"> (c) <div class="red"> (d) <div class="big">
  37. 37.What does text-align do? (a) picks the font style (b) centres a heading (c) colours behind the text (d) makes letters bigger
  38. 38.✍️ Which property is set to center in this rule?
    .note {
      font-weight: bold;
      text-align: center;
      background-color: yellow;
      font-size: 20px;
    }
    (a) center (b) background-color (c) text-align (d) margin
  39. 39.🧩 Which language puts a picture on a page? (a) JavaScript (b) CSS (c) HTML
  40. 40.📦 In the box model, which part is the text or picture? (a) border (b) padding (c) content (d) margin

Answer key

  1. <style>
  2. border
  3. color
  4. blue
  5. changes the text size
  6. .note
  7. 36
  8. color
  9. equal gaps, none at ends
  10. Yes
  11. HTML
  12. 6
  13. Yes
  14. No
  15. font-size
  16. puts boxes in the middle
  17. 3
  18. 4
  19. <li class="big">
  20. ;
  21. li
  22. purple
  23. counts down a timer
  24. 3
  25. 252
  26. yellow
  27. False
  28. 800px or wider
  29. in the middle
  30. white
  31. 330
  32. red
  33. an id selector
  34. red
  35. 30
  36. <div class="big">
  37. centres a heading
  38. text-align
  39. HTML
  40. content

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