← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 512 · 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 is the selector in this CSS rule?
    h2 {
      border: 2px solid;
      padding: 8px;
    }
    (a) border (b) h2 (c) h1 (d) 8px
  2. 2.📱 Responsive design means a page ___. (a) fits every screen (b) never changes (c) has no pictures (d) is only for laptops
  3. 3.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 24px;
      }
    }
  4. 4.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 16px;
      }
    }
  5. 5.⚖️ Which selector is the strongest? (a) a class selector (b) an element selector (c) an id selector
  6. 6.🎯 Which CSS selector matches this element?
    <p class="box" id="hero">Hello</p>
    (a) #top (b) #hero (c) #box (d) .star
  7. 7.🌈 Which hex code is black? (a) #00ffff (b) #0000ff (c) #ffffff (d) #000000
  8. 8.✍️ Which sign goes between a property and its value? (a) = (b) : (c) - (d) ;
  9. 9.🎯 Which element does the selector .box style? (a) <h1 class="star"> (b) <h2 class="menu"> (c) <h1 class="box"> (d) <h1 id="box">
  10. 10.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 340px;
      justify-content: center;
    }
    Inside are 3 boxes, each 60px wide (no margins).
  11. 11.🌈 Which colour is #000000? (a) bright green (b) magenta (c) black (d) red
  12. 12.🎯 How many elements on a page should have the same id? (a) any number (b) 5 (c) 1 (d) 2
  13. 13.🖌️ Which CSS property colours behind the text? (a) color (b) background-color (c) font-weight (d) font-size
  14. 14.🧩 Which language puts a picture on a page? (a) CSS (b) JavaScript (c) HTML
  15. 15.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 320px;
      justify-content: flex-end;
    }
    Inside are 3 boxes, each 80px wide (no margins).
  16. 16.🎨 One CSS file can style how many pages? (a) many pages (b) only one image (c) only one word (d) no pages
  17. 17.🧩 Which language makes headings and lists? (a) JavaScript (b) CSS (c) HTML
  18. 18.🖌️ Which CSS property makes the text bold? (a) font-size (b) background-color (c) font-family (d) font-weight
  19. 19.What does justify-content: flex-end do? (a) packs boxes at the end (b) puts boxes in the middle (c) packs boxes at the start (d) equal gaps, none at ends
  20. 20.True or false: body is a class selector. (a) True (b) False
  21. 21.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 220px;
      padding: 10px;
      border: 5px solid black;
      margin: 15px;
    }
  22. 22.Which of these does HTML do? (a) counts down a timer (b) adds space around boxes (c) makes a form box (d) shows a pop-up message
  23. 23.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 270px;
      justify-content: flex-start;
    }
    Inside are 4 boxes, each 50px wide (no margins).
  24. 24.True or false: CSS checks a quiz answer. (a) True (b) False
  25. 25.⚖️ What colour is the text of this element?
    <h2 class="star" id="main">Hi</h2>
    CSS:
    .star { color: red; }
    .star { color: green; }
    (a) orange (b) green (c) blue (d) red
  26. 26.True or false: margin is the gap to other boxes. (a) False (b) True
  27. 27.💪 Which justify-content value packs boxes at the end? (a) flex-end (b) center (c) space-between (d) flex-start
  28. 28.What does justify-content: flex-start 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
  29. 29.🖌️ Which CSS property picks the font style? (a) background-color (b) color (c) font-family (d) text-align
  30. 30.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the first one (b) neither (c) the shorter one (d) the later one
  31. 31.True or false: margin is the gap round content. (a) False (b) True
  32. 32.⚖️ What colour is the text of this element?
    <h1 class="note" id="hero">Hi</h1>
    CSS:
    #hero { color: red; }
    #hero { color: green; }
    (a) black (b) blue (c) red (d) green
  33. 33.True or false: JavaScript sets colours and fonts. (a) True (b) False
  34. 34.🔍 Which is the odd one out? (a) changes the page live (b) shows a pop-up message (c) reacts to a button click (d) puts a picture on a page
  35. 35.📱 min-width: 800px applies when the screen is ___. (a) 800px or narrower (b) 800px or wider (c) exactly 100px (d) turned off
  36. 36.Which of these does CSS do? (a) makes headings and lists (b) puts a picture on a page (c) adds space around boxes (d) counts down a timer
  37. 37.🌈 Hex digits go 0 to 9, then A to which letter? (a) J (b) G (c) Z (d) F
  38. 38.🌈 Which colour is #ff00ff? (a) white (b) red (c) bright green (d) magenta
  39. 39.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 220px;
      justify-content: space-between;
    }
    Inside are 4 boxes, each 40px wide (no margins).
  40. 40.🧩 Which language checks a quiz answer? (a) CSS (b) JavaScript (c) HTML

Answer key

  1. h2
  2. fits every screen
  3. 24
  4. 20
  5. an id selector
  6. #hero
  7. #000000
  8. :
  9. <h1 class="box">
  10. 80
  11. black
  12. 1
  13. background-color
  14. HTML
  15. 80
  16. many pages
  17. HTML
  18. font-weight
  19. packs boxes at the end
  20. False
  21. 250
  22. makes a form box
  23. 70
  24. False
  25. green
  26. True
  27. flex-end
  28. packs boxes at the start
  29. font-family
  30. the later one
  31. False
  32. green
  33. False
  34. puts a picture on a page
  35. 800px or wider
  36. adds space around boxes
  37. F
  38. magenta
  39. 20
  40. JavaScript

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