← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 893 · 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 of these is margin? (a) the gap to other boxes (b) space inside the border (c) a solid or dotted edge (d) the text or picture
  2. 2.🔍 Which is the odd one out? (a) reacts to a button click (b) shows a pop-up message (c) checks a quiz answer (d) puts a picture on a page
  3. 3.🎯 Which CSS selector matches this element?
    <span class="star" id="top">Hello</span>
    (a) p (b) span (c) #star (d) #intro
  4. 4.⚖️ Which selector is the strongest? (a) an id selector (b) an element selector (c) a class selector
  5. 5.True or false: #top is an id selector. (a) True (b) False
  6. 6.🖌️ How big is the text, in px?
    h2 {
      background-color: red;
      font-size: 32px;
      text-align: left;
      color: green;
    }
  7. 7.What does font-size do? (a) centres a heading (b) picks the font style (c) colours behind the text (d) makes letters bigger
  8. 8.True or false: .note is an id selector. (a) True (b) False
  9. 9.📱 Which tag helps phones show a page at the right size? (a) the hr tag (b) the br tag (c) the viewport meta tag (d) the title tag
  10. 10.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 24px;
      }
    }
  11. 11.⚖️ What colour is the text of this element?
    <h1 class="star" id="intro">Hi</h1>
    CSS:
    #intro { color: black; }
    h1 { color: red; }
    .star { color: blue; }
    (a) red (b) blue (c) purple (d) black
  12. 12.🌈 Which colour of light is strongest in rgb(136, 194, 26)? (a) blue (b) red (c) green
  13. 13.✍️ How does a CSS comment start? (a) /* (b) // (c) <!-- (d) #
  14. 14.🔍 Which is the odd one out? (a) makes headings and lists (b) makes a link (c) makes a form box (d) shows a pop-up message
  15. 15.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 120px;
      padding: 10px;
      border: 2px solid black;
      margin: 15px;
    }
  16. 16.True or false: the border is a solid or dotted edge. (a) False (b) True
  17. 17.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the later one (b) the first one (c) neither (d) the shorter one
  18. 18.✍️ What is the selector in this CSS rule?
    body {
      border: 2px solid;
      font-style: italic;
      background-color: yellow;
    }
    (a) .box (b) body (c) italic (d) border
  19. 19.🎯 What kind of selector is .card? (a) an element selector (b) a class selector (c) an id selector
  20. 20.🖌️ What colour is behind the letters?
    h1 {
      text-align: left;
      color: black;
      background-color: purple;
      font-size: 12px;
    }
    (a) purple (b) black (c) green
  21. 21.🎯 Which CSS selector matches this element?
    <div class="box" id="top">Hello</div>
    (a) .top (b) #box (c) .box (d) .star
  22. 22.🌈 Which hex code is bright green? (a) #0000ff (b) #000000 (c) #00ff00 (d) #ffffff
  23. 23.⚖️ What colour is the text of this element?
    <p class="box" id="end">Hi</p>
    CSS:
    .box { color: purple; }
    #end { color: yellow; }
    p { color: white; }
    (a) purple (b) white (c) yellow (d) orange
  24. 24.True or false: the border is the text or picture. (a) False (b) True
  25. 25.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 220px;
      justify-content: center;
    }
    Inside are 2 boxes, each 40px wide (no margins).
  26. 26.⚖️ What colour is the text of this element?
    <h2 class="big" id="logo">Hi</h2>
    CSS:
    h2 { color: black; }
    #logo { color: yellow; }
    (a) purple (b) yellow (c) green (d) black
  27. 27.🌈 Which colour is #00ff00? (a) bright green (b) magenta (c) cyan (d) black
  28. 28.Which of these is the border? (a) the gap round content (b) a solid or dotted edge (c) space inside the border (d) the text or picture
  29. 29.🧩 Which language counts down a timer? (a) HTML (b) JavaScript (c) CSS
  30. 30.What does font-weight do? (a) makes letters bigger (b) colours behind the text (c) makes the text bold (d) sets the letter colour
  31. 31.🎯 Which CSS selector matches this element?
    <div class="star" id="main">Hello</div>
    (a) #star (b) .star (c) .menu (d) #logo
  32. 32.🌈 In #df0000 the red part is the hex number df. What is it as a normal number?
  33. 33.✍️ How many declarations (property: value pairs) are in this rule?
    li {
      color: red;
      text-align: center;
      font-style: italic;
      font-size: 20px;
    }
  34. 34.Which of these does JavaScript do? (a) adds space around boxes (b) sets colours and fonts (c) shows a pop-up message (d) makes a link
  35. 35.🎯 What kind of selector is #main? (a) an id selector (b) an element selector (c) a class selector
  36. 36.🎨 A CSS file usually ends with which extension? (a) .js (b) .png (c) .html (d) .css
  37. 37.📱 max-width: 600px applies when the screen is ___. (a) turned off (b) exactly 1000px (c) 600px or narrower (d) 600px or wider
  38. 38.✍️ Which property is set to 10px in this rule?
    body {
      margin: 10px;
      font-style: italic;
    }
    (a) 10px (b) margin (c) font-weight (d) padding
  39. 39.True or false: CSS puts a picture on a page. (a) True (b) False
  40. 40.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 90px;
      padding: 25px;
      border: 5px solid black;
      margin: 15px;
    }

Answer key

  1. the gap to other boxes
  2. puts a picture on a page
  3. span
  4. an id selector
  5. True
  6. 32
  7. makes letters bigger
  8. False
  9. the viewport meta tag
  10. 24
  11. black
  12. green
  13. /*
  14. shows a pop-up message
  15. 174
  16. True
  17. the later one
  18. body
  19. a class selector
  20. purple
  21. .box
  22. #00ff00
  23. yellow
  24. False
  25. 70
  26. yellow
  27. bright green
  28. a solid or dotted edge
  29. JavaScript
  30. makes the text bold
  31. .star
  32. 223
  33. 4
  34. shows a pop-up message
  35. an id selector
  36. .css
  37. 600px or narrower
  38. margin
  39. False
  40. 180

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