← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 551 · 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.🖌️ How big is the text, in px?
    p {
      text-align: center;
      color: orange;
      background-color: white;
      font-size: 12px;
    }
  2. 2.📦 In the box model, which part is the gap to other boxes? (a) content (b) margin (c) border (d) padding
  3. 3.True or false: CSS counts down a timer. (a) True (b) False
  4. 4.💪 Which flexbox property spaces boxes along a row? (a) align-items (b) display: flex (c) gap (d) justify-content
  5. 5.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 190px;
      padding: 15px;
      border: 1px solid black;
      margin: 20px;
    }
  6. 6.🌈 Which colour of light is strongest in rgb(69, 106, 211)? (a) blue (b) green (c) red
  7. 7.🌈 Hex digits go 0 to 9, then A to which letter? (a) Z (b) G (c) F (d) J
  8. 8.🖌️ How big is the text, in px?
    p {
      font-size: 32px;
      background-color: green;
      color: blue;
      text-align: center;
    }
  9. 9.✍️ How does a CSS comment start? (a) /* (b) <!-- (c) // (d) #
  10. 10.True or false: .big is an id selector. (a) False (b) True
  11. 11.What does background-color do? (a) makes letters bigger (b) colours behind the text (c) picks the font style (d) sets the letter colour
  12. 12.📱 The screen is 1100px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 8px;
      }
    }
    (a) Yes (b) No
  13. 13.📱 min-width: 800px applies when the screen is ___. (a) 800px or narrower (b) turned off (c) 800px or wider (d) exactly 100px
  14. 14.✍️ What is the selector in this CSS rule?
    body {
      margin: 10px;
      font-style: italic;
    }
    (a) italic (b) body (c) .box (d) margin
  15. 15.🧩 Which language checks a quiz answer? (a) HTML (b) CSS (c) JavaScript
  16. 16.⚖️ Which selector is the weakest? (a) an element selector (b) a class selector (c) an id selector
  17. 17.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 160px;
      padding: 30px;
      border: 2px solid black;
      margin: 10px;
    }
  18. 18.🌈 Which colour of light is strongest in rgb(32, 240, 41)? (a) green (b) blue (c) red
  19. 19.🎯 Which CSS selector matches this element?
    <div class="box" id="top">Hello</div>
    (a) span (b) #intro (c) #box (d) div
  20. 20.✍️ Which property is set to bold in this rule?
    p {
      text-align: center;
      font-weight: bold;
    }
    (a) width (b) bold (c) font-weight (d) border
  21. 21.⚖️ What colour is the text of this element?
    <h1 class="menu" id="end">Hi</h1>
    CSS:
    h1 { color: purple; }
    h1 { color: white; }
    (a) red (b) green (c) purple (d) white
  22. 22.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 160px;
      padding: 10px;
      border: 2px solid black;
      margin: 15px;
    }
  23. 23.🎯 Which CSS selector matches this element?
    <li class="box" id="main">Hello</li>
    (a) .main (b) .star (c) li (d) div
  24. 24.Which of these does JavaScript do? (a) reacts to a button click (b) gives the page structure (c) rounds box corners (d) changes the text size
  25. 25.🌈 In #002200 the green part is the hex number 22. What is it as a normal number?
  26. 26.✍️ Which sign goes between a property and its value? (a) ; (b) = (c) : (d) -
  27. 27.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 150px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 60px wide (no margins).
  28. 28.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 80px;
      padding: 15px;
      border: 1px solid black;
      margin: 15px;
    }
  29. 29.🎯 What kind of selector is img? (a) an id selector (b) a class selector (c) an element selector
  30. 30.True or false: margin is the gap to other boxes. (a) True (b) False
  31. 31.📦 In the box model, which part is the line round the box? (a) content (b) border (c) margin (d) padding
  32. 32.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 200px;
      justify-content: flex-start;
    }
    Inside are 3 boxes, each 60px wide (no margins).
  33. 33.🎯 Which element does the selector .box style? (a) <li class="box"> (b) <li class="star"> (c) <li id="box"> (d) <div class="menu">
  34. 34.🧩 Which language adds space around boxes? (a) HTML (b) CSS (c) JavaScript
  35. 35.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 10px;
      }
    }
    (a) No (b) Yes
  36. 36.📦 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: 10px;
    }
  37. 37.🌈 Which colour is #ff00ff? (a) white (b) magenta (c) cyan (d) blue
  38. 38.⚖️ What colour is the text of this element?
    <h1 class="box" id="main">Hi</h1>
    CSS:
    #main { color: orange; }
    #main { color: blue; }
    (a) blue (b) green (c) red (d) orange
  39. 39.📱 Responsive design means a page ___. (a) fits every screen (b) has no pictures (c) is only for laptops (d) never changes
  40. 40.Which of these does HTML do? (a) shows a pop-up message (b) makes a link (c) adds space around boxes (d) changes the page live

Answer key

  1. 12
  2. margin
  3. False
  4. justify-content
  5. 262
  6. blue
  7. F
  8. 32
  9. /*
  10. False
  11. colours behind the text
  12. No
  13. 800px or wider
  14. body
  15. JavaScript
  16. an element selector
  17. 244
  18. green
  19. div
  20. font-weight
  21. white
  22. 214
  23. li
  24. reacts to a button click
  25. 34
  26. :
  27. 30
  28. 112
  29. an element selector
  30. True
  31. border
  32. 20
  33. <li class="box">
  34. CSS
  35. Yes
  36. 272
  37. magenta
  38. blue
  39. fits every screen
  40. makes a link

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