← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 712 · 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.📱 The screen is 414px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 8px;
      }
    }
    (a) Yes (b) No
  2. 2.🖌️ What colour are the letters?
    h1 {
      text-align: left;
      background-color: black;
      font-size: 32px;
      color: yellow;
    }
    (a) black (b) yellow (c) white
  3. 3.⚖️ What colour is the text of this element?
    <h1 class="box" id="intro">Hi</h1>
    CSS:
    h1 { color: orange; }
    h1 { color: white; }
    (a) red (b) white (c) yellow (d) orange
  4. 4.⚖️ What colour is the text of this element?
    <p class="note" id="top">Hi</p>
    CSS:
    #top { color: red; }
    .note { color: black; }
    (a) blue (b) black (c) red (d) green
  5. 5.True or false: .big is a class selector. (a) False (b) True
  6. 6.What does font-family do? (a) sets the letter colour (b) makes letters bigger (c) picks the font style (d) centres a heading
  7. 7.⚖️ Which selector is the strongest? (a) an element selector (b) an id selector (c) a class selector
  8. 8.True or false: the border is the line round the box. (a) False (b) True
  9. 9.🎯 What kind of selector is p? (a) an id selector (b) a class selector (c) an element selector
  10. 10.🎯 How many elements on a page should have the same id? (a) 2 (b) any number (c) 5 (d) 1
  11. 11.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 250px;
      justify-content: flex-start;
    }
    Inside are 4 boxes, each 50px wide (no margins).
  12. 12.⚖️ What colour is the text of this element?
    <h1 class="red" id="main">Hi</h1>
    CSS:
    .red { color: orange; }
    .red { color: green; }
    (a) green (b) white (c) orange (d) black
  13. 13.⚖️ What colour is the text of this element?
    <p class="note" id="hero">Hi</p>
    CSS:
    .note { color: white; }
    #hero { color: black; }
    (a) black (b) white (c) yellow (d) red
  14. 14.📱 What does a media query check? (a) the page title (b) the time of day (c) the battery level (d) the screen width
  15. 15.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
  16. 16.⚖️ What colour is the text of this element?
    <h1 class="note" id="logo">Hi</h1>
    CSS:
    h1 { color: blue; }
    h1 { color: green; }
    (a) green (b) purple (c) blue (d) orange
  17. 17.🎯 Which CSS selector matches this element?
    <p class="star" id="logo">Hello</p>
    (a) h1 (b) #end (c) .logo (d) .star
  18. 18.🎯 What kind of selector is li? (a) a class selector (b) an id selector (c) an element selector
  19. 19.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 250px;
      padding: 10px;
      border: 1px solid black;
      margin: 15px;
    }
  20. 20.🔍 Which is the odd one out? (a) rounds box corners (b) changes the page live (c) lays out the page (d) adds space around boxes
  21. 21.✍️ What value is given to background-color in this rule?
    h1 {
      font-style: italic;
      background-color: yellow;
    }
    (a) 8px (b) 10px (c) background-color (d) yellow
  22. 22.True or false: #hero is an element selector. (a) False (b) True
  23. 23.True or false: li is a class selector. (a) False (b) True
  24. 24.🎯 What kind of selector is .card? (a) an element selector (b) a class selector (c) an id selector
  25. 25.🎯 Which CSS selector matches this element?
    <h2 class="red" id="logo">Hello</h2>
    (a) #red (b) .red (c) .logo (d) li
  26. 26.✍️ How many declarations (property: value pairs) are in this rule?
    p {
      font-style: italic;
    }
  27. 27.🌈 Which colour of light is strongest in rgb(180, 80, 68)? (a) red (b) blue (c) green
  28. 28.✍️ What value is given to margin in this rule?
    p {
      margin: 10px;
      font-weight: bold;
    }
    (a) margin (b) 8px (c) bold (d) 10px
  29. 29.🌈 Which colour of light is strongest in rgb(180, 134, 54)? (a) red (b) blue (c) green
  30. 30.Which of these does JavaScript do? (a) puts a picture on a page (b) changes the page live (c) sets colours and fonts (d) changes the text size
  31. 31.What does text-align do? (a) picks the font style (b) makes the text bold (c) sets the letter colour (d) centres a heading
  32. 32.✍️ What value is given to margin in this rule?
    p {
      border: 2px solid;
      margin: 10px;
      color: red;
    }
    (a) 8px (b) bold (c) 10px (d) margin
  33. 33.✍️ How many declarations (property: value pairs) are in this rule?
    body {
      margin: 10px;
    }
  34. 34.⚖️ What colour is the text of this element?
    <p class="big" id="hero">Hi</p>
    CSS:
    #hero { color: yellow; }
    p { color: black; }
    (a) black (b) blue (c) orange (d) yellow
  35. 35.Which of these does JavaScript do? (a) makes a form box (b) lays out the page (c) sets colours and fonts (d) checks a quiz answer
  36. 36.🧩 Which language changes the text size? (a) HTML (b) CSS (c) JavaScript
  37. 37.What does font-size do? (a) makes letters bigger (b) sets the letter colour (c) picks the font style (d) makes the text bold
  38. 38.✍️ What is the selector in this CSS rule?
    .note {
      background-color: yellow;
      font-size: 20px;
    }
    (a) #top (b) 20px (c) background-color (d) .note
  39. 39.🧩 Which language makes a form box? (a) CSS (b) JavaScript (c) HTML
  40. 40.🧩 Which language makes a link? (a) JavaScript (b) CSS (c) HTML

Answer key

  1. Yes
  2. yellow
  3. white
  4. red
  5. True
  6. picks the font style
  7. an id selector
  8. True
  9. an element selector
  10. 1
  11. 50
  12. green
  13. black
  14. the screen width
  15. equal gaps, none at ends
  16. green
  17. .star
  18. an element selector
  19. 272
  20. changes the page live
  21. yellow
  22. False
  23. False
  24. a class selector
  25. .red
  26. 1
  27. red
  28. 10px
  29. red
  30. changes the page live
  31. centres a heading
  32. 10px
  33. 1
  34. yellow
  35. checks a quiz answer
  36. CSS
  37. makes letters bigger
  38. .note
  39. HTML
  40. HTML

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