← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 685 · 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.🎯 What kind of selector is body? (a) an id selector (b) a class selector (c) an element selector
  2. 2.⚖️ What colour is the text of this element?
    <p class="note" id="main">Hi</p>
    CSS:
    #main { color: green; }
    #main { color: red; }
    (a) green (b) white (c) yellow (d) red
  3. 3.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 12px;
      }
    }
  4. 4.🔍 Which is the odd one out? (a) changes the page live (b) checks a quiz answer (c) changes the text size (d) reacts to a button click
  5. 5.🎯 Which element does the selector #hero style? (a) <h2 class="hero"> (b) <li class="box"> (c) <h2 id="top"> (d) <h2 id="hero">
  6. 6.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 210px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 100px wide (no margins).
  7. 7.📦 In the box model, which part is the gap round content? (a) content (b) padding (c) border (d) margin
  8. 8.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 20px;
      }
    }
  9. 9.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 60px;
      padding: 25px;
      border: 3px solid black;
      margin: 5px;
    }
  10. 10.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 70px;
      padding: 5px;
      border: 5px solid black;
      margin: 0px;
    }
  11. 11.✍️ In color: blue; which part is the value? (a) color (b) blue (c) ; (d) :
  12. 12.📦 In the box model, which part is the text or picture? (a) margin (b) content (c) border (d) padding
  13. 13.⚖️ Which selector is the strongest? (a) an id selector (b) a class selector (c) an element selector
  14. 14.✍️ CSS declarations go inside which brackets? (a) { } (b) ( ) (c) [ ] (d) < >
  15. 15.What does justify-content: center do? (a) packs boxes at the start (b) puts boxes in the middle (c) packs boxes at the end (d) equal gaps, none at ends
  16. 16.💪 Which flexbox property lines boxes up across? (a) justify-content (b) align-items (c) display: flex (d) flex-direction
  17. 17.True or false: HTML puts a picture on a page. (a) True (b) False
  18. 18.True or false: .menu is an id selector. (a) False (b) True
  19. 19.🖌️ What colour is behind the letters?
    p {
      background-color: orange;
      text-align: center;
      font-size: 32px;
      color: white;
    }
    (a) yellow (b) white (c) orange
  20. 20.📱 min-width: 800px applies when the screen is ___. (a) 800px or narrower (b) exactly 100px (c) turned off (d) 800px or wider
  21. 21.✍️ How does a CSS comment start? (a) # (b) <!-- (c) // (d) /*
  22. 22.True or false: margin is the text or picture. (a) True (b) False
  23. 23.🎯 Which element does the selector h1 style? (a) <h2> (b) <div id="hero"> (c) <li class="red"> (d) <h1 class="red">
  24. 24.🌈 Which colour of light is strongest in rgb(33, 218, 105)? (a) blue (b) red (c) green
  25. 25.📱 What does a media query check? (a) the page title (b) the screen width (c) the time of day (d) the battery level
  26. 26.🎯 Which CSS selector matches this element?
    <h1 class="note" id="intro">Hello</h1>
    (a) .big (b) h2 (c) #main (d) h1
  27. 27.Which of these is the border? (a) the gap round content (b) space inside the border (c) the line round the box (d) space outside the border
  28. 28.📦 In the box model, which part is a solid or dotted edge? (a) margin (b) padding (c) content (d) border
  29. 29.True or false: .note is an element selector. (a) False (b) True
  30. 30.✍️ Which property is set to 20px in this rule?
    li {
      width: 300px;
      border: 2px solid;
      font-size: 20px;
    }
    (a) 20px (b) text-align (c) background-color (d) font-size
  31. 31.🧩 Which language shows a pop-up message? (a) CSS (b) HTML (c) JavaScript
  32. 32.📱 max-width: 600px applies when the screen is ___. (a) exactly 1000px (b) 600px or narrower (c) turned off (d) 600px or wider
  33. 33.🎯 What kind of selector is #top? (a) an element selector (b) a class selector (c) an id selector
  34. 34.🎯 Which element does the selector div style? (a) <span> (b) <p class="menu"> (c) <h1 id="intro"> (d) <div class="menu">
  35. 35.🎯 Which CSS selector matches this element?
    <h1 class="big" id="logo">Hello</h1>
    (a) h1 (b) #end (c) #big (d) h2
  36. 36.🖌️ How big is the text, in px?
    h1 {
      background-color: white;
      text-align: center;
      font-size: 16px;
      color: purple;
    }
  37. 37.Which of these is padding? (a) the text or picture (b) space outside the border (c) the line round the box (d) the gap round content
  38. 38.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 150px;
      padding: 25px;
      border: 3px solid black;
      margin: 0px;
    }
  39. 39.What does justify-content: space-between do? (a) equal gaps, none at ends (b) puts boxes in the middle (c) packs boxes at the start (d) packs boxes at the end
  40. 40.🎨 A CSS file usually ends with which extension? (a) .js (b) .html (c) .png (d) .css

Answer key

  1. an element selector
  2. red
  3. 12
  4. changes the text size
  5. <h2 id="hero">
  6. 10
  7. padding
  8. 20
  9. 126
  10. 90
  11. blue
  12. content
  13. an id selector
  14. { }
  15. puts boxes in the middle
  16. align-items
  17. True
  18. False
  19. orange
  20. 800px or wider
  21. /*
  22. False
  23. <h1 class="red">
  24. green
  25. the screen width
  26. h1
  27. the line round the box
  28. border
  29. False
  30. font-size
  31. JavaScript
  32. 600px or narrower
  33. an id selector
  34. <div class="menu">
  35. h1
  36. 16
  37. the gap round content
  38. 206
  39. equal gaps, none at ends
  40. .css

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