← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 83 · 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 colour is the text of this element?
    <h1 class="big" id="logo">Hi</h1>
    CSS:
    .big { color: black; }
    .big { color: green; }
    (a) blue (b) purple (c) black (d) green
  2. 2.📱 The screen is 1100px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 6px;
      }
    }
    (a) Yes (b) No
  3. 3.🎯 Can many elements share the same class? (a) Yes (b) No
  4. 4.📱 Which tag helps phones show a page at the right size? (a) the br tag (b) the viewport meta tag (c) the title tag (d) the hr tag
  5. 5.True or false: CSS sets colours and fonts. (a) True (b) False
  6. 6.📱 The screen is 700px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 12px;
      }
    }
    (a) Yes (b) No
  7. 7.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 12px;
      }
    }
  8. 8.✍️ Which property is set to center in this rule?
    p {
      margin: 10px;
      text-align: center;
    }
    (a) background-color (b) center (c) text-align (d) margin
  9. 9.True or false: JavaScript counts down a timer. (a) True (b) False
  10. 10.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 220px;
      padding: 20px;
      border: 4px solid black;
      margin: 5px;
    }
  11. 11.What does background-color do? (a) centres a heading (b) picks the font style (c) makes the text bold (d) colours behind the text
  12. 12.✍️ What is the selector in this CSS rule?
    li {
      border: 2px solid;
      padding: 8px;
    }
    (a) border (b) 8px (c) body (d) li
  13. 13.📱 The screen is 1366px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 32px;
      }
    }
    (a) No (b) Yes
  14. 14.📱 min-width: 800px applies when the screen is ___. (a) 800px or narrower (b) turned off (c) exactly 100px (d) 800px or wider
  15. 15.📱 The screen is 540px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 20px;
      }
    }
    (a) Yes (b) No
  16. 16.🎨 Which attribute adds CSS inside one tag? (a) src (b) alt (c) style (d) href
  17. 17.🧩 Which language changes the text size? (a) JavaScript (b) HTML (c) CSS
  18. 18.⚖️ Which selector is the strongest? (a) an id selector (b) an element selector (c) a class selector
  19. 19.True or false: JavaScript makes headings and lists. (a) True (b) False
  20. 20.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 2 (b) 4 (c) 6 (d) 3
  21. 21.🎯 What kind of selector is .big? (a) a class selector (b) an element selector (c) an id selector
  22. 22.🎯 Which sign starts a class selector? (a) # (b) & (c) . (d) @
  23. 23.📦 In the box model, which part is space inside the border? (a) margin (b) border (c) content (d) padding
  24. 24.✍️ How many declarations (property: value pairs) are in this rule?
    body {
      margin: 10px;
      padding: 8px;
    }
  25. 25.✍️ In color: blue; which part is the property? (a) ; (b) : (c) color (d) blue
  26. 26.🎨 Which tag holds CSS inside the head? (a) <css> (b) <script> (c) <style> (d) <body>
  27. 27.What does color do? (a) makes letters bigger (b) picks the font style (c) makes the text bold (d) sets the letter colour
  28. 28.True or false: JavaScript puts a picture on a page. (a) True (b) False
  29. 29.⚖️ What colour is the text of this element?
    <h1 class="big" id="hero">Hi</h1>
    CSS:
    #hero { color: green; }
    #hero { color: white; }
    (a) yellow (b) black (c) white (d) green
  30. 30.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 10px;
      }
    }
  31. 31.🌈 Which colour of light is strongest in rgb(128, 221, 121)? (a) green (b) red (c) blue
  32. 32.🌈 Which hex code is magenta? (a) #00ff00 (b) #ff00ff (c) #00ffff (d) #ff0000
  33. 33.🎯 Which element does the selector #intro style? (a) <h1 id="intro"> (b) <h1 id="main"> (c) <h1 class="intro"> (d) <h2 class="box">
  34. 34.💪 Which justify-content value equal gaps, none at ends? (a) space-between (b) flex-end (c) center (d) flex-start
  35. 35.🎯 Which CSS selector matches this element?
    <li class="star" id="logo">Hello</li>
    (a) #end (b) div (c) .menu (d) .star
  36. 36.🖌️ Where does the text sit on its line?
    h1 {
      text-align: right;
      color: white;
      background-color: black;
      font-size: 40px;
    }
    (a) on the left (b) in the middle (c) on the right
  37. 37.✍️ Which property is set to italic in this rule?
    h1 {
      text-align: center;
      padding: 8px;
      font-style: italic;
    }
    (a) italic (b) color (c) font-size (d) font-style
  38. 38.🌈 Which colour of light is strongest in rgb(179, 105, 75)? (a) blue (b) green (c) red
  39. 39.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 28px;
      }
    }
  40. 40.💪 Which flexbox property lines boxes up across? (a) display: flex (b) gap (c) flex-direction (d) align-items

Answer key

  1. green
  2. No
  3. Yes
  4. the viewport meta tag
  5. True
  6. Yes
  7. 12
  8. text-align
  9. True
  10. 278
  11. colours behind the text
  12. li
  13. Yes
  14. 800px or wider
  15. No
  16. style
  17. CSS
  18. an id selector
  19. False
  20. 3
  21. a class selector
  22. .
  23. padding
  24. 2
  25. color
  26. <style>
  27. sets the letter colour
  28. False
  29. white
  30. 10
  31. green
  32. #ff00ff
  33. <h1 id="intro">
  34. space-between
  35. .star
  36. on the right
  37. font-style
  38. red
  39. 28
  40. align-items

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