← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 898 · 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 #main style? (a) <span id="logo"> (b) <span id="main"> (c) <p class="menu"> (d) <span class="main">
  2. 2.✍️ What is the selector in this CSS rule?
    #top {
      font-style: italic;
      margin: 10px;
      padding: 8px;
    }
    (a) #top (b) font-style (c) li (d) 10px
  3. 3.📦 In the box model, which part is the text or picture? (a) border (b) margin (c) content (d) padding
  4. 4.✍️ What is the selector in this CSS rule?
    li {
      width: 300px;
      background-color: yellow;
      font-size: 20px;
      text-align: center;
    }
    (a) yellow (b) width (c) body (d) li
  5. 5.🖌️ Which CSS property centres a heading? (a) font-size (b) text-align (c) background-color (d) font-family
  6. 6.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 8px;
      }
    }
  7. 7.✍️ How many declarations (property: value pairs) are in this rule?
    .note {
      border: 2px solid;
      margin: 10px;
    }
  8. 8.🎯 How many elements on a page should have the same id? (a) any number (b) 1 (c) 5 (d) 2
  9. 9.🖌️ What colour are the letters?
    h1 {
      background-color: blue;
      color: green;
      font-size: 32px;
      text-align: left;
    }
    (a) yellow (b) green (c) blue
  10. 10.✍️ In color: blue; which part is the property? (a) blue (b) : (c) color (d) ;
  11. 11.True or false: JavaScript sets colours and fonts. (a) True (b) False
  12. 12.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 300px;
      justify-content: center;
    }
    Inside are 3 boxes, each 60px wide (no margins).
  13. 13.Which of these does JavaScript do? (a) adds space around boxes (b) puts a picture on a page (c) shows a pop-up message (d) sets colours and fonts
  14. 14.🔍 Which is the odd one out? (a) shows a pop-up message (b) puts a picture on a page (c) changes the page live (d) counts down a timer
  15. 15.🌈 Which colour is rgb(255, 0, 255)? (a) cyan (b) blue (c) yellow (d) magenta
  16. 16.⚖️ What colour is the text of this element?
    <p class="star" id="intro">Hi</p>
    CSS:
    p { color: green; }
    p { color: purple; }
    (a) blue (b) red (c) green (d) purple
  17. 17.🖌️ Which CSS property sets the letter colour? (a) font-family (b) color (c) text-align (d) font-weight
  18. 18.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 24px;
      }
    }
  19. 19.🧩 Which language reacts to a button click? (a) CSS (b) JavaScript (c) HTML
  20. 20.What does font-weight do? (a) picks the font style (b) makes the text bold (c) centres a heading (d) colours behind the text
  21. 21.🎯 Which sign starts an id selector? (a) @ (b) & (c) . (d) #
  22. 22.Which of these does HTML do? (a) rounds box corners (b) gives the page structure (c) reacts to a button click (d) adds space around boxes
  23. 23.⚖️ What colour is the text of this element?
    <h1 class="red" id="intro">Hi</h1>
    CSS:
    .red { color: blue; }
    #intro { color: orange; }
    (a) orange (b) blue (c) yellow (d) red
  24. 24.🎯 Which element does the selector .red style? (a) <p class="red"> (b) <p class="box"> (c) <p id="red"> (d) <h1 class="star">
  25. 25.🌈 Which colour is rgb(0, 255, 255)? (a) yellow (b) cyan (c) bright green (d) red
  26. 26.🖌️ How big is the text, in px?
    h1 {
      color: black;
      font-size: 40px;
      background-color: white;
      text-align: center;
    }
  27. 27.🖌️ How big is the text, in px?
    p {
      background-color: purple;
      font-size: 40px;
      color: red;
      text-align: center;
    }
  28. 28.📱 Which tag helps phones show a page at the right size? (a) the title tag (b) the viewport meta tag (c) the hr tag (d) the br tag
  29. 29.🔍 Which is the odd one out? (a) counts down a timer (b) changes the text size (c) adds space around boxes (d) sets colours and fonts
  30. 30.📦 In the box model, which part is the gap to other boxes? (a) padding (b) margin (c) border (d) content
  31. 31.🧩 Which language makes a link? (a) JavaScript (b) CSS (c) HTML
  32. 32.✍️ Which property is set to center in this rule?
    .note {
      width: 300px;
      text-align: center;
    }
    (a) background-color (b) text-align (c) margin (d) center
  33. 33.📦 In the box model, which part is a solid or dotted edge? (a) margin (b) content (c) padding (d) border
  34. 34.✍️ Which property is set to 10px in this rule?
    h2 {
      padding: 8px;
      background-color: yellow;
      margin: 10px;
      width: 300px;
    }
    (a) margin (b) 10px (c) padding (d) font-weight
  35. 35.True or false: padding is a solid or dotted edge. (a) True (b) False
  36. 36.True or false: .big is a class selector. (a) False (b) True
  37. 37.⚖️ What colour is the text of this element?
    <h1 class="box" id="top">Hi</h1>
    CSS:
    .box { color: green; }
    #top { color: blue; }
    h1 { color: white; }
    (a) white (b) blue (c) green (d) purple
  38. 38.What does font-size do? (a) picks the font style (b) colours behind the text (c) centres a heading (d) makes letters bigger
  39. 39.🧩 Which language adds space around boxes? (a) JavaScript (b) CSS (c) HTML
  40. 40.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 120px;
      justify-content: flex-end;
    }
    Inside are 2 boxes, each 40px wide (no margins).

Answer key

  1. <span id="main">
  2. #top
  3. content
  4. li
  5. text-align
  6. 8
  7. 2
  8. 1
  9. green
  10. color
  11. False
  12. 60
  13. shows a pop-up message
  14. puts a picture on a page
  15. magenta
  16. purple
  17. color
  18. 20
  19. JavaScript
  20. makes the text bold
  21. #
  22. gives the page structure
  23. orange
  24. <p class="red">
  25. cyan
  26. 40
  27. 40
  28. the viewport meta tag
  29. counts down a timer
  30. margin
  31. HTML
  32. text-align
  33. border
  34. margin
  35. False
  36. True
  37. blue
  38. makes letters bigger
  39. CSS
  40. 40

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