← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 423 · 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.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 24px;
      }
    }
  2. 2.🌈 Which colour is #000000? (a) red (b) blue (c) black (d) white
  3. 3.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 16px;
      }
    }
  4. 4.🎯 Which CSS selector matches this element?
    <p class="menu" id="hero">Hello</p>
    (a) .note (b) #top (c) #menu (d) p
  5. 5.🎨 Which tag holds CSS inside the head? (a) <style> (b) <script> (c) <body> (d) <css>
  6. 6.What does color do? (a) colours behind the text (b) sets the letter colour (c) picks the font style (d) makes letters bigger
  7. 7.🖌️ What colour is behind the letters?
    li {
      color: purple;
      text-align: left;
      font-size: 12px;
      background-color: red;
    }
    (a) purple (b) blue (c) red
  8. 8.🎯 What kind of selector is img? (a) an id selector (b) an element selector (c) a class selector
  9. 9.✍️ What value is given to color in this rule?
    h2 {
      color: red;
      border: 2px solid;
      width: 300px;
      text-align: center;
    }
    (a) center (b) color (c) red (d) 20px
  10. 10.🌈 Which colour is #ffff00? (a) black (b) bright green (c) red (d) yellow
  11. 11.🎯 Which CSS selector matches this element?
    <li class="red" id="intro">Hello</li>
    (a) li (b) #red (c) #main (d) .box
  12. 12.💪 Which justify-content value equal gaps, none at ends? (a) center (b) space-between (c) flex-end (d) flex-start
  13. 13.🧩 Which language shows a pop-up message? (a) CSS (b) HTML (c) JavaScript
  14. 14.📱 Responsive design means a page ___. (a) fits every screen (b) has no pictures (c) is only for laptops (d) never changes
  15. 15.✍️ What value is given to font-weight in this rule?
    .note {
      width: 300px;
      font-weight: bold;
    }
    (a) font-weight (b) bold (c) 2px solid (d) 300px
  16. 16.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 10px;
      }
    }
    (a) No (b) Yes
  17. 17.🎯 Which CSS selector matches this element?
    <h2 class="menu" id="logo">Hello</h2>
    (a) #menu (b) .logo (c) h2 (d) .note
  18. 18.Which of these does JavaScript do? (a) reacts to a button click (b) puts a picture on a page (c) makes headings and lists (d) gives the page structure
  19. 19.🎨 What does CSS stand for? (a) Colourful Site Styles (b) Cascading Style Sheets (c) Creative Sheet System (d) Computer Style Sheets
  20. 20.True or false: CSS adds space around boxes. (a) True (b) False
  21. 21.🌈 In #0000bb the blue part is the hex number bb. What is it as a normal number?
  22. 22.⚖️ What colour is the text of this element?
    <h2 class="note" id="hero">Hi</h2>
    CSS:
    .note { color: orange; }
    h2 { color: yellow; }
    (a) green (b) orange (c) red (d) yellow
  23. 23.What does font-weight do? (a) colours behind the text (b) makes the text bold (c) picks the font style (d) sets the letter colour
  24. 24.🎯 Which CSS selector matches this element?
    <div class="red" id="main">Hello</div>
    (a) .box (b) div (c) #red (d) .main
  25. 25.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 180px;
      justify-content: flex-start;
    }
    Inside are 4 boxes, each 40px wide (no margins).
  26. 26.📱 min-width: 800px applies when the screen is ___. (a) 800px or narrower (b) turned off (c) 800px or wider (d) exactly 100px
  27. 27.🎨 Which attribute adds CSS inside one tag? (a) src (b) href (c) alt (d) style
  28. 28.✍️ What value is given to margin in this rule?
    .note {
      font-weight: bold;
      border: 2px solid;
      padding: 8px;
      margin: 10px;
    }
    (a) margin (b) 8px (c) 10px (d) bold
  29. 29.True or false: HTML sets colours and fonts. (a) True (b) False
  30. 30.🎯 Which sign starts an id selector? (a) # (b) & (c) @ (d) .
  31. 31.💪 Which justify-content value puts boxes in the middle? (a) flex-end (b) center (c) flex-start (d) space-between
  32. 32.True or false: padding is the text or picture. (a) False (b) True
  33. 33.🧩 Which language makes a link? (a) JavaScript (b) CSS (c) HTML
  34. 34.🌈 Which colour is #00ff00? (a) yellow (b) bright green (c) white (d) red
  35. 35.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 140px;
      padding: 20px;
      border: 1px solid black;
      margin: 5px;
    }
  36. 36.🌈 Which colour of light is strongest in rgb(69, 82, 156)? (a) red (b) blue (c) green
  37. 37.Which of these does CSS do? (a) counts down a timer (b) changes the page live (c) reacts to a button click (d) lays out the page
  38. 38.🖌️ Which CSS property picks the font style? (a) text-align (b) font-size (c) font-family (d) background-color
  39. 39.🌈 Which colour of light is strongest in rgb(139, 158, 112)? (a) red (b) green (c) blue
  40. 40.✍️ What is the selector in this CSS rule?
    li {
      font-style: italic;
      font-weight: bold;
      border: 2px solid;
    }
    (a) li (b) body (c) bold (d) font-style

Answer key

  1. 16
  2. black
  3. 12
  4. p
  5. <style>
  6. sets the letter colour
  7. red
  8. an element selector
  9. red
  10. yellow
  11. li
  12. space-between
  13. JavaScript
  14. fits every screen
  15. bold
  16. Yes
  17. h2
  18. reacts to a button click
  19. Cascading Style Sheets
  20. True
  21. 187
  22. orange
  23. makes the text bold
  24. div
  25. 20
  26. 800px or wider
  27. style
  28. 10px
  29. False
  30. #
  31. center
  32. False
  33. HTML
  34. bright green
  35. 192
  36. blue
  37. lays out the page
  38. font-family
  39. green
  40. li

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