← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 497 · 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 element does the selector h2 style? (a) <h2 class="big"> (b) <span id="hero"> (c) <li> (d) <div class="big">
  2. 2.Which of these does HTML do? (a) counts down a timer (b) makes a form box (c) changes the page live (d) lays out the page
  3. 3.🌈 Which colour is #00ff00? (a) blue (b) bright green (c) white (d) magenta
  4. 4.📱 Responsive design means a page ___. (a) has no pictures (b) fits every screen (c) is only for laptops (d) never changes
  5. 5.🖌️ Which CSS property colours behind the text? (a) text-align (b) color (c) font-size (d) background-color
  6. 6.True or false: HTML changes the text size. (a) False (b) True
  7. 7.What does background-color do? (a) picks the font style (b) colours behind the text (c) sets the letter colour (d) makes the text bold
  8. 8.🎨 Which tag connects an outside CSS file? (a) <img> (b) <link> (c) <css> (d) <a>
  9. 9.📦 In the box model, which part is the gap to other boxes? (a) margin (b) padding (c) content (d) border
  10. 10.⚖️ What colour is the text of this element?
    <p class="note" id="top">Hi</p>
    CSS:
    .note { color: white; }
    p { color: yellow; }
    #top { color: purple; }
    (a) blue (b) purple (c) yellow (d) white
  11. 11.🖌️ Which CSS property centres a heading? (a) text-align (b) font-weight (c) font-family (d) color
  12. 12.📦 In the box model, which part is the line round the box? (a) border (b) margin (c) content (d) padding
  13. 13.Which of these is margin? (a) the line round the box (b) the gap to other boxes (c) a solid or dotted edge (d) space inside the border
  14. 14.✍️ Which sign ends each CSS declaration? (a) , (b) : (c) ; (d) .
  15. 15.✍️ How many declarations (property: value pairs) are in this rule?
    h2 {
      padding: 8px;
      font-size: 20px;
      color: red;
      margin: 10px;
    }
  16. 16.🔍 Which is the odd one out? (a) makes a form box (b) makes headings and lists (c) puts a picture on a page (d) reacts to a button click
  17. 17.✍️ What is the selector in this CSS rule?
    #top {
      font-size: 20px;
      font-style: italic;
      border: 2px solid;
    }
    (a) font-size (b) li (c) italic (d) #top
  18. 18.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 220px;
      justify-content: space-between;
    }
    Inside are 2 boxes, each 100px wide (no margins).
  19. 19.✍️ Which property is set to yellow in this rule?
    h1 {
      margin: 10px;
      font-size: 20px;
      padding: 8px;
      background-color: yellow;
    }
    (a) background-color (b) yellow (c) margin (d) padding
  20. 20.⚖️ Which selector is the weakest? (a) an element selector (b) a class selector (c) an id selector
  21. 21.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 170px;
      justify-content: space-between;
    }
    Inside are 2 boxes, each 60px wide (no margins).
  22. 22.True or false: CSS changes the text size. (a) True (b) False
  23. 23.True or false: p is an element selector. (a) False (b) True
  24. 24.What does font-weight do? (a) makes letters bigger (b) makes the text bold (c) picks the font style (d) colours behind the text
  25. 25.🎯 Which element does the selector #intro style? (a) <span id="main"> (b) <p class="box"> (c) <span id="intro"> (d) <span class="intro">
  26. 26.🎯 What kind of selector is .note? (a) an element selector (b) a class selector (c) an id selector
  27. 27.🎯 Can many elements share the same class? (a) No (b) Yes
  28. 28.💪 Which justify-content value packs boxes at the end? (a) center (b) flex-start (c) space-between (d) flex-end
  29. 29.🎯 Which CSS selector matches this element?
    <span class="menu" id="top">Hello</span>
    (a) .note (b) #top (c) #intro (d) #menu
  30. 30.🌈 Which colour is rgb(0, 255, 0)? (a) white (b) yellow (c) black (d) bright green
  31. 31.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 18px;
      }
    }
  32. 32.🎯 How many elements on a page should have the same id? (a) 5 (b) 2 (c) any number (d) 1
  33. 33.Which of these does JavaScript do? (a) makes headings and lists (b) gives the page structure (c) adds space around boxes (d) checks a quiz answer
  34. 34.True or false: .card is an element selector. (a) True (b) False
  35. 35.💪 Which flexbox property picks row or column? (a) gap (b) display: flex (c) align-items (d) flex-direction
  36. 36.🌈 Which colour is #0000ff? (a) yellow (b) blue (c) cyan (d) white
  37. 37.✍️ In color: blue; which part is the property? (a) blue (b) color (c) ; (d) :
  38. 38.⚖️ What colour is the text of this element?
    <p class="big" id="end">Hi</p>
    CSS:
    p { color: green; }
    #end { color: yellow; }
    .big { color: white; }
    (a) yellow (b) green (c) orange (d) white
  39. 39.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 80px;
      padding: 25px;
      border: 5px solid black;
      margin: 5px;
    }
  40. 40.⚖️ What colour is the text of this element?
    <h1 class="red" id="logo">Hi</h1>
    CSS:
    #logo { color: red; }
    #logo { color: orange; }
    (a) green (b) purple (c) red (d) orange

Answer key

  1. <h2 class="big">
  2. makes a form box
  3. bright green
  4. fits every screen
  5. background-color
  6. False
  7. colours behind the text
  8. <link>
  9. margin
  10. purple
  11. text-align
  12. border
  13. the gap to other boxes
  14. ;
  15. 4
  16. reacts to a button click
  17. #top
  18. 20
  19. background-color
  20. an element selector
  21. 50
  22. True
  23. True
  24. makes the text bold
  25. <span id="intro">
  26. a class selector
  27. Yes
  28. flex-end
  29. #top
  30. bright green
  31. 16
  32. 1
  33. checks a quiz answer
  34. False
  35. flex-direction
  36. blue
  37. color
  38. yellow
  39. 150
  40. orange

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