← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 236 · 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 p? (a) a class selector (b) an element selector (c) an id selector
  2. 2.True or false: CSS makes headings and lists. (a) False (b) True
  3. 3.💪 Which flexbox property picks row or column? (a) display: flex (b) justify-content (c) align-items (d) flex-direction
  4. 4.🎯 How many elements on a page should have the same id? (a) any number (b) 2 (c) 5 (d) 1
  5. 5.True or false: CSS sets colours and fonts. (a) False (b) True
  6. 6.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 160px;
      justify-content: flex-start;
    }
    Inside are 3 boxes, each 40px wide (no margins).
  7. 7.🎯 Which element does the selector #hero style? (a) <span id="top"> (b) <span id="hero"> (c) <span class="hero"> (d) <p class="note">
  8. 8.✍️ What is the selector in this CSS rule?
    body {
      padding: 8px;
      font-style: italic;
      width: 300px;
    }
    (a) padding (b) italic (c) .box (d) body
  9. 9.📱 max-width: 600px applies when the screen is ___. (a) turned off (b) exactly 1000px (c) 600px or narrower (d) 600px or wider
  10. 10.🎨 One CSS file can style how many pages? (a) only one image (b) no pages (c) many pages (d) only one word
  11. 11.✍️ How many declarations (property: value pairs) are in this rule?
    h1 {
      color: red;
    }
  12. 12.✍️ What is the selector in this CSS rule?
    body {
      font-size: 20px;
      font-weight: bold;
    }
    (a) .box (b) bold (c) body (d) font-size
  13. 13.True or false: padding is the text or picture. (a) False (b) True
  14. 14.🔍 Which is the odd one out? (a) makes headings and lists (b) rounds box corners (c) sets colours and fonts (d) adds space around boxes
  15. 15.🔍 Which is the odd one out? (a) makes a link (b) makes a form box (c) shows a pop-up message (d) gives the page structure
  16. 16.Which of these is margin? (a) a solid or dotted edge (b) space outside the border (c) the gap round content (d) the line round the box
  17. 17.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 250px;
      padding: 30px;
      border: 1px solid black;
      margin: 5px;
    }
  18. 18.🌈 Which colour is #00ffff? (a) red (b) cyan (c) white (d) yellow
  19. 19.✍️ What value is given to margin in this rule?
    .note {
      text-align: center;
      margin: 10px;
    }
    (a) margin (b) 10px (c) bold (d) 8px
  20. 20.⚖️ What colour is the text of this element?
    <p class="red" id="intro">Hi</p>
    CSS:
    p { color: purple; }
    p { color: green; }
    (a) purple (b) blue (c) yellow (d) green
  21. 21.🖌️ Where does the text sit on its line?
    h1 {
      font-size: 32px;
      text-align: center;
      color: blue;
      background-color: black;
    }
    (a) on the right (b) on the left (c) in the middle
  22. 22.🌈 Which colour is rgb(255, 255, 255)? (a) cyan (b) bright green (c) black (d) white
  23. 23.🎯 What kind of selector is h1? (a) a class selector (b) an id selector (c) an element selector
  24. 24.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 18px;
      }
    }
  25. 25.🧩 Which language makes a link? (a) HTML (b) JavaScript (c) CSS
  26. 26.🖌️ What colour are the letters?
    p {
      font-size: 20px;
      text-align: center;
      color: orange;
      background-color: yellow;
    }
    (a) red (b) orange (c) yellow
  27. 27.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 18px;
      }
    }
    (a) Yes (b) No
  28. 28.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the first one (b) the later one (c) the shorter one (d) neither
  29. 29.🎯 Which CSS selector matches this element?
    <span class="note" id="hero">Hello</span>
    (a) #hero (b) .hero (c) .big (d) p
  30. 30.🌈 Which colour is #00ff00? (a) red (b) bright green (c) cyan (d) blue
  31. 31.🌈 In #0000c2 the blue part is the hex number c2. What is it as a normal number?
  32. 32.What does font-weight do? (a) centres a heading (b) sets the letter colour (c) makes letters bigger (d) makes the text bold
  33. 33.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 18px;
      }
    }
  34. 34.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
  35. 35.True or false: HTML reacts to a button click. (a) False (b) True
  36. 36.True or false: margin is the line round the box. (a) True (b) False
  37. 37.🖌️ Which CSS property picks the font style? (a) background-color (b) font-weight (c) font-family (d) color
  38. 38.Which of these does HTML do? (a) shows a pop-up message (b) rounds box corners (c) makes a form box (d) checks a quiz answer
  39. 39.🎯 Which element does the selector .note style? (a) <h1 id="note"> (b) <h1 class="note"> (c) <h2 class="red"> (d) <h1 class="big">
  40. 40.🧩 Which language lays out the page? (a) CSS (b) JavaScript (c) HTML

Answer key

  1. an element selector
  2. False
  3. flex-direction
  4. 1
  5. True
  6. 40
  7. <span id="hero">
  8. body
  9. 600px or narrower
  10. many pages
  11. 1
  12. body
  13. False
  14. makes headings and lists
  15. shows a pop-up message
  16. space outside the border
  17. 322
  18. cyan
  19. 10px
  20. green
  21. in the middle
  22. white
  23. an element selector
  24. 12
  25. HTML
  26. orange
  27. No
  28. the later one
  29. #hero
  30. bright green
  31. 194
  32. makes the text bold
  33. 20
  34. puts boxes in the middle
  35. False
  36. False
  37. font-family
  38. makes a form box
  39. <h1 class="note">
  40. CSS

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