← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 313 · 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 colour is rgb(255, 0, 0)? (a) yellow (b) red (c) blue (d) white
  2. 2.🧩 Which language counts down a timer? (a) HTML (b) CSS (c) JavaScript
  3. 3.🎯 Which element does the selector .menu style? (a) <p class="big"> (b) <span class="note"> (c) <span class="menu"> (d) <span id="menu">
  4. 4.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 250px;
      padding: 5px;
      border: 3px solid black;
      margin: 15px;
    }
  5. 5.🧩 Which language lays out the page? (a) CSS (b) JavaScript (c) HTML
  6. 6.True or false: the border is the line round the box. (a) False (b) True
  7. 7.🖌️ Which CSS property sets the letter colour? (a) background-color (b) text-align (c) color (d) font-weight
  8. 8.Which of these does CSS do? (a) shows a pop-up message (b) counts down a timer (c) adds space around boxes (d) makes headings and lists
  9. 9.🌈 Which colour of light is strongest in rgb(170, 81, 127)? (a) blue (b) red (c) green
  10. 10.🎯 Which sign starts a class selector? (a) # (b) @ (c) & (d) .
  11. 11.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 430px;
      justify-content: flex-end;
    }
    Inside are 4 boxes, each 100px wide (no margins).
  12. 12.✍️ Which property is set to 8px in this rule?
    p {
      padding: 8px;
      width: 300px;
    }
    (a) 8px (b) border (c) padding (d) font-weight
  13. 13.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 8px;
      }
    }
  14. 14.✍️ In color: blue; which part is the property? (a) : (b) ; (c) blue (d) color
  15. 15.⚖️ What colour is the text of this element?
    <h2 class="red" id="hero">Hi</h2>
    CSS:
    h2 { color: black; }
    h2 { color: red; }
    (a) black (b) purple (c) red (d) orange
  16. 16.📦 In the box model, which part is space inside the border? (a) margin (b) padding (c) border (d) content
  17. 17.What does font-weight do? (a) makes letters bigger (b) picks the font style (c) makes the text bold (d) centres a heading
  18. 18.🎯 Which element does the selector p style? (a) <p class="menu"> (b) <li id="logo"> (c) <h1> (d) <h2 class="menu">
  19. 19.⚖️ What colour is the text of this element?
    <h2 class="box" id="end">Hi</h2>
    CSS:
    #end { color: green; }
    #end { color: red; }
    (a) orange (b) purple (c) red (d) green
  20. 20.⚖️ Two rules with the same selector set a colour. Which one wins? (a) neither (b) the later one (c) the first one (d) the shorter one
  21. 21.🖌️ What colour are the letters?
    h1 {
      background-color: black;
      text-align: left;
      font-size: 20px;
      color: blue;
    }
    (a) green (b) black (c) blue
  22. 22.🌈 Which colour is #0000ff? (a) white (b) red (c) magenta (d) blue
  23. 23.True or false: HTML reacts to a button click. (a) True (b) False
  24. 24.What does font-size do? (a) centres a heading (b) makes letters bigger (c) picks the font style (d) colours behind the text
  25. 25.⚖️ What colour is the text of this element?
    <h2 class="note" id="logo">Hi</h2>
    CSS:
    h2 { color: red; }
    h2 { color: black; }
    (a) black (b) purple (c) red (d) green
  26. 26.✍️ Which property is set to 300px in this rule?
    body {
      width: 300px;
      font-style: italic;
      background-color: yellow;
    }
    (a) font-style (b) color (c) width (d) 300px
  27. 27.🎯 What kind of selector is h1? (a) an element selector (b) a class selector (c) an id selector
  28. 28.🎨 Which attribute adds CSS inside one tag? (a) src (b) alt (c) href (d) style
  29. 29.True or false: margin is the gap round content. (a) True (b) False
  30. 30.⚖️ What colour is the text of this element?
    <p class="big" id="top">Hi</p>
    CSS:
    .big { color: black; }
    #top { color: blue; }
    p { color: green; }
    (a) black (b) green (c) purple (d) blue
  31. 31.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 180px;
      padding: 25px;
      border: 4px solid black;
      margin: 15px;
    }
  32. 32.📱 Which tag helps phones show a page at the right size? (a) the viewport meta tag (b) the hr tag (c) the title tag (d) the br tag
  33. 33.🖌️ How big is the text, in px?
    li {
      font-size: 28px;
      background-color: blue;
      text-align: right;
      color: green;
    }
  34. 34.⚖️ Which selector is the weakest? (a) a class selector (b) an element selector (c) an id selector
  35. 35.🎯 Which CSS selector matches this element?
    <div class="box" id="intro">Hello</div>
    (a) .intro (b) span (c) #main (d) div
  36. 36.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 20px;
      }
    }
  37. 37.What does justify-content: flex-start do? (a) puts boxes in the middle (b) equal gaps, none at ends (c) packs boxes at the end (d) packs boxes at the start
  38. 38.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 260px;
      justify-content: center;
    }
    Inside are 4 boxes, each 40px wide (no margins).
  39. 39.🎯 Can many elements share the same class? (a) Yes (b) No
  40. 40.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 28px;
      }
    }

Answer key

  1. red
  2. JavaScript
  3. <span class="menu">
  4. 296
  5. CSS
  6. True
  7. color
  8. adds space around boxes
  9. red
  10. .
  11. 30
  12. padding
  13. 8
  14. color
  15. red
  16. padding
  17. makes the text bold
  18. <p class="menu">
  19. red
  20. the later one
  21. blue
  22. blue
  23. False
  24. makes letters bigger
  25. black
  26. width
  27. an element selector
  28. style
  29. False
  30. blue
  31. 268
  32. the viewport meta tag
  33. 28
  34. an element selector
  35. div
  36. 12
  37. packs boxes at the start
  38. 50
  39. Yes
  40. 20

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