← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 307 · 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 property is set to 20px in this rule?
    p {
      color: red;
      font-size: 20px;
      background-color: yellow;
    }
    (a) font-size (b) background-color (c) 20px (d) text-align
  2. 2.True or false: #main is an id selector. (a) True (b) False
  3. 3.🎯 What kind of selector is li? (a) an id selector (b) a class selector (c) an element selector
  4. 4.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 26px;
      }
    }
  5. 5.🌈 Which hex code is magenta? (a) #ffffff (b) #ff00ff (c) #000000 (d) #ff0000
  6. 6.🖌️ Which CSS property colours behind the text? (a) background-color (b) font-family (c) font-size (d) text-align
  7. 7.True or false: HTML shows a pop-up message. (a) True (b) False
  8. 8.📱 The screen is 820px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 30px;
      }
    }
    (a) Yes (b) No
  9. 9.🎯 Which sign starts a class selector? (a) . (b) # (c) @ (d) &
  10. 10.🌈 Which colour is rgb(255, 0, 0)? (a) black (b) bright green (c) cyan (d) red
  11. 11.🧩 Which language makes headings and lists? (a) JavaScript (b) CSS (c) HTML
  12. 12.📦 In the box model, which part is space inside the border? (a) margin (b) border (c) padding (d) content
  13. 13.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 500px;
      justify-content: center;
    }
    Inside are 4 boxes, each 100px wide (no margins).
  14. 14.🖌️ What colour is behind the letters?
    p {
      color: red;
      text-align: center;
      background-color: white;
      font-size: 24px;
    }
    (a) purple (b) red (c) white
  15. 15.🖌️ Which CSS property makes letters bigger? (a) font-family (b) color (c) background-color (d) font-size
  16. 16.🧩 Which language reacts to a button click? (a) HTML (b) CSS (c) JavaScript
  17. 17.⚖️ Which selector is the strongest? (a) an id selector (b) a class selector (c) an element selector
  18. 18.🌈 Which colour of light is strongest in rgb(237, 5, 112)? (a) green (b) blue (c) red
  19. 19.True or false: .star is an id selector. (a) True (b) False
  20. 20.🌈 Which colour is rgb(255, 0, 255)? (a) black (b) yellow (c) bright green (d) magenta
  21. 21.True or false: CSS makes a link. (a) True (b) False
  22. 22.🌈 What is the biggest number one colour can have in rgb()? (a) 99 (b) 1000 (c) 100 (d) 255
  23. 23.🎯 Which element does the selector span style? (a) <p> (b) <h1 class="box"> (c) <span class="box"> (d) <h2 id="intro">
  24. 24.✍️ How does a CSS comment start? (a) <!-- (b) /* (c) // (d) #
  25. 25.True or false: CSS lays out the page. (a) False (b) True
  26. 26.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 390px;
      justify-content: space-between;
    }
    Inside are 4 boxes, each 60px wide (no margins).
  27. 27.✍️ How many declarations (property: value pairs) are in this rule?
    h1 {
      background-color: yellow;
    }
  28. 28.True or false: padding is the text or picture. (a) True (b) False
  29. 29.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 60px;
      padding: 30px;
      border: 3px solid black;
      margin: 5px;
    }
  30. 30.✍️ CSS declarations go inside which brackets? (a) [ ] (b) < > (c) ( ) (d) { }
  31. 31.✍️ How many declarations (property: value pairs) are in this rule?
    li {
      width: 300px;
      color: red;
      font-weight: bold;
      border: 2px solid;
    }
  32. 32.🧩 Which language checks a quiz answer? (a) CSS (b) HTML (c) JavaScript
  33. 33.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 30px;
      }
    }
  34. 34.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 20px;
      }
    }
  35. 35.✍️ In color: blue; which part is the property? (a) blue (b) : (c) color (d) ;
  36. 36.⚖️ What colour is the text of this element?
    <p class="menu" id="top">Hi</p>
    CSS:
    p { color: yellow; }
    .menu { color: black; }
    (a) yellow (b) red (c) black (d) orange
  37. 37.True or false: CSS adds space around boxes. (a) False (b) True
  38. 38.🌈 In #0000a3 the blue part is the hex number a3. What is it as a normal number?
  39. 39.✍️ What is the selector in this CSS rule?
    .note {
      padding: 8px;
      width: 300px;
      text-align: center;
    }
    (a) 300px (b) padding (c) #top (d) .note
  40. 40.🎯 Which CSS selector matches this element?
    <h1 class="menu" id="top">Hello</h1>
    (a) .top (b) h1 (c) .note (d) #intro

Answer key

  1. font-size
  2. True
  3. an element selector
  4. 26
  5. #ff00ff
  6. background-color
  7. False
  8. Yes
  9. .
  10. red
  11. HTML
  12. padding
  13. 50
  14. white
  15. font-size
  16. JavaScript
  17. an id selector
  18. red
  19. False
  20. magenta
  21. False
  22. 255
  23. <span class="box">
  24. /*
  25. True
  26. 50
  27. 1
  28. False
  29. 126
  30. { }
  31. 4
  32. JavaScript
  33. 24
  34. 20
  35. color
  36. black
  37. True
  38. 163
  39. .note
  40. h1

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