← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 269 · 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 span style? (a) <h2 id="top"> (b) <p> (c) <h1 class="red"> (d) <span class="red">
  2. 2.🎯 Which element does the selector #logo style? (a) <p id="end"> (b) <p id="logo"> (c) <h1 class="big"> (d) <p class="logo">
  3. 3.🎯 How many elements on a page should have the same id? (a) any number (b) 1 (c) 5 (d) 2
  4. 4.⚖️ What colour is the text of this element?
    <h1 class="star" id="hero">Hi</h1>
    CSS:
    #hero { color: black; }
    #hero { color: yellow; }
    (a) black (b) blue (c) yellow (d) white
  5. 5.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 12px;
      }
    }
  6. 6.True or false: JavaScript rounds box corners. (a) True (b) False
  7. 7.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 150px;
      justify-content: space-between;
    }
    Inside are 2 boxes, each 60px wide (no margins).
  8. 8.Which of these is the content? (a) space outside the border (b) a solid or dotted edge (c) the text or picture (d) space inside the border
  9. 9.🎯 What kind of selector is #main? (a) an element selector (b) a class selector (c) an id selector
  10. 10.📱 Which tag helps phones show a page at the right size? (a) the title tag (b) the hr tag (c) the viewport meta tag (d) the br tag
  11. 11.📱 max-width: 600px applies when the screen is ___. (a) turned off (b) 600px or wider (c) 600px or narrower (d) exactly 1000px
  12. 12.✍️ What is the selector in this CSS rule?
    h2 {
      font-size: 20px;
      font-style: italic;
    }
    (a) h1 (b) italic (c) font-size (d) h2
  13. 13.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 80px;
      padding: 10px;
      border: 3px solid black;
      margin: 0px;
    }
  14. 14.✍️ How many declarations (property: value pairs) are in this rule?
    h2 {
      font-style: italic;
      width: 300px;
    }
  15. 15.Which of these does HTML do? (a) reacts to a button click (b) makes headings and lists (c) sets colours and fonts (d) shows a pop-up message
  16. 16.🖌️ How big is the text, in px?
    h1 {
      text-align: center;
      background-color: purple;
      color: white;
      font-size: 28px;
    }
  17. 17.🧩 Which language gives the page structure? (a) JavaScript (b) CSS (c) HTML
  18. 18.True or false: CSS changes the text size. (a) False (b) True
  19. 19.🎯 Which element does the selector #hero style? (a) <h1 id="hero"> (b) <h2 class="big"> (c) <h1 class="hero"> (d) <h1 id="top">
  20. 20.💪 Which flexbox property picks row or column? (a) display: flex (b) flex-direction (c) align-items (d) justify-content
  21. 21.⚖️ Which selector is the strongest? (a) an element selector (b) a class selector (c) an id selector
  22. 22.What does background-color do? (a) makes letters bigger (b) colours behind the text (c) sets the letter colour (d) makes the text bold
  23. 23.⚖️ What colour is the text of this element?
    <p class="red" id="top">Hi</p>
    CSS:
    p { color: red; }
    #top { color: blue; }
    (a) black (b) blue (c) orange (d) red
  24. 24.🧩 Which language checks a quiz answer? (a) JavaScript (b) HTML (c) CSS
  25. 25.🌈 In #rrggbb, which colour do the last two digits give? (a) white (b) blue (c) red (d) green
  26. 26.🎯 What kind of selector is .note? (a) an id selector (b) an element selector (c) a class selector
  27. 27.🎯 Which CSS selector matches this element?
    <h2 class="big" id="logo">Hello</h2>
    (a) li (b) .red (c) #big (d) h2
  28. 28.What does text-align do? (a) sets the letter colour (b) makes letters bigger (c) colours behind the text (d) centres a heading
  29. 29.🌈 Which colour is rgb(0, 0, 0)? (a) black (b) red (c) bright green (d) cyan
  30. 30.🧩 Which language makes a link? (a) HTML (b) JavaScript (c) CSS
  31. 31.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 320px;
      justify-content: center;
    }
    Inside are 2 boxes, each 100px wide (no margins).
  32. 32.✍️ Which sign goes between a property and its value? (a) = (b) ; (c) - (d) :
  33. 33.✍️ Which property is set to center in this rule?
    p {
      text-align: center;
      width: 300px;
    }
    (a) margin (b) text-align (c) center (d) background-color
  34. 34.⚖️ What colour is the text of this element?
    <h1 class="big" id="logo">Hi</h1>
    CSS:
    #logo { color: orange; }
    .big { color: green; }
    (a) green (b) black (c) purple (d) orange
  35. 35.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 16px;
      }
    }
  36. 36.✍️ Which property is set to center in this rule?
    p {
      text-align: center;
      font-size: 20px;
      font-style: italic;
    }
    (a) background-color (b) text-align (c) margin (d) center
  37. 37.True or false: JavaScript shows a pop-up message. (a) True (b) False
  38. 38.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 14px;
      }
    }
  39. 39.🌈 Which colour is #ff0000? (a) white (b) magenta (c) red (d) yellow
  40. 40.🎯 Which CSS selector matches this element?
    <span class="big" id="top">Hello</span>
    (a) #big (b) #intro (c) span (d) p

Answer key

  1. <span class="red">
  2. <p id="logo">
  3. 1
  4. yellow
  5. 12
  6. False
  7. 30
  8. the text or picture
  9. an id selector
  10. the viewport meta tag
  11. 600px or narrower
  12. h2
  13. 106
  14. 2
  15. makes headings and lists
  16. 28
  17. HTML
  18. True
  19. <h1 id="hero">
  20. flex-direction
  21. an id selector
  22. colours behind the text
  23. blue
  24. JavaScript
  25. blue
  26. a class selector
  27. h2
  28. centres a heading
  29. black
  30. HTML
  31. 60
  32. :
  33. text-align
  34. orange
  35. 16
  36. text-align
  37. True
  38. 12
  39. red
  40. span

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