← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 886 · 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 1100px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 18px;
      }
    }
    (a) No (b) Yes
  2. 2.Which of these does CSS do? (a) gives the page structure (b) counts down a timer (c) makes a form box (d) rounds box corners
  3. 3.🌈 Which colour is #ffffff? (a) black (b) red (c) white (d) blue
  4. 4.📦 In the box model, which part is the line round the box? (a) padding (b) content (c) margin (d) border
  5. 5.🖌️ Which CSS property colours behind the text? (a) font-size (b) background-color (c) color (d) font-family
  6. 6.🌈 Which hex code is red? (a) #ff00ff (b) #ffffff (c) #00ffff (d) #ff0000
  7. 7.What does justify-content: flex-start do? (a) packs boxes at the start (b) puts boxes in the middle (c) equal gaps, none at ends (d) packs boxes at the end
  8. 8.🖌️ How big is the text, in px?
    li {
      font-size: 36px;
      text-align: right;
      color: red;
      background-color: green;
    }
  9. 9.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 180px;
      padding: 10px;
      border: 5px solid black;
      margin: 0px;
    }
  10. 10.💪 Which flexbox property picks row or column? (a) align-items (b) display: flex (c) flex-direction (d) gap
  11. 11.🧩 Which language makes a link? (a) HTML (b) JavaScript (c) CSS
  12. 12.🖌️ What colour are the letters?
    p {
      font-size: 36px;
      color: orange;
      background-color: purple;
      text-align: right;
    }
    (a) yellow (b) purple (c) orange
  13. 13.🎯 Which sign starts a class selector? (a) @ (b) # (c) & (d) .
  14. 14.🎯 Which element does the selector h2 style? (a) <span id="intro"> (b) <div class="box"> (c) <h2 class="box"> (d) <li>
  15. 15.🌈 Which colour is rgb(255, 0, 0)? (a) black (b) blue (c) magenta (d) red
  16. 16.🌈 Which hex code is magenta? (a) #ffffff (b) #ff0000 (c) #000000 (d) #ff00ff
  17. 17.🎨 Which tag holds CSS inside the head? (a) <script> (b) <style> (c) <css> (d) <body>
  18. 18.⚖️ What colour is the text of this element?
    <h2 class="box" id="main">Hi</h2>
    CSS:
    h2 { color: red; }
    h2 { color: yellow; }
    (a) blue (b) black (c) red (d) yellow
  19. 19.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 12px;
      }
    }
  20. 20.🎯 Can many elements share the same class? (a) No (b) Yes
  21. 21.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 350px;
      justify-content: space-between;
    }
    Inside are 4 boxes, each 80px wide (no margins).
  22. 22.🖌️ What colour are the letters?
    p {
      background-color: white;
      font-size: 16px;
      color: purple;
      text-align: left;
    }
    (a) purple (b) green (c) white
  23. 23.✍️ Which property is set to yellow in this rule?
    #top {
      background-color: yellow;
      margin: 10px;
      border: 2px solid;
    }
    (a) yellow (b) margin (c) padding (d) background-color
  24. 24.What does background-color do? (a) colours behind the text (b) makes the text bold (c) centres a heading (d) picks the font style
  25. 25.✍️ What value is given to padding in this rule?
    h2 {
      padding: 8px;
      font-style: italic;
      font-weight: bold;
      background-color: yellow;
    }
    (a) 2px solid (b) bold (c) padding (d) 8px
  26. 26.🔍 Which is the odd one out? (a) changes the page live (b) checks a quiz answer (c) adds space around boxes (d) reacts to a button click
  27. 27.🎨 What does CSS stand for? (a) Creative Sheet System (b) Computer Style Sheets (c) Colourful Site Styles (d) Cascading Style Sheets
  28. 28.Which of these does HTML do? (a) puts a picture on a page (b) shows a pop-up message (c) changes the text size (d) adds space around boxes
  29. 29.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 250px;
      padding: 25px;
      border: 3px solid black;
      margin: 10px;
    }
  30. 30.🌈 Which colour of light is strongest in rgb(182, 86, 75)? (a) red (b) green (c) blue
  31. 31.✍️ In color: blue; which part is the property? (a) : (b) ; (c) blue (d) color
  32. 32.🖌️ What colour are the letters?
    h2 {
      background-color: red;
      font-size: 40px;
      color: purple;
      text-align: left;
    }
    (a) red (b) purple (c) orange
  33. 33.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 70px;
      padding: 30px;
      border: 5px solid black;
      margin: 15px;
    }
  34. 34.⚖️ Two rules with the same selector set a colour. Which one wins? (a) neither (b) the shorter one (c) the first one (d) the later one
  35. 35.🖌️ What colour are the letters?
    h1 {
      background-color: blue;
      color: purple;
      text-align: center;
      font-size: 12px;
    }
    (a) purple (b) white (c) blue
  36. 36.🎯 Which element does the selector #top style? (a) <div id="top"> (b) <div id="intro"> (c) <div class="top"> (d) <span class="star">
  37. 37.⚖️ What colour is the text of this element?
    <h2 class="star" id="intro">Hi</h2>
    CSS:
    h2 { color: green; }
    .star { color: yellow; }
    (a) orange (b) white (c) green (d) yellow
  38. 38.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 22px;
      }
    }
  39. 39.⚖️ What colour is the text of this element?
    <h2 class="big" id="intro">Hi</h2>
    CSS:
    .big { color: green; }
    .big { color: black; }
    (a) white (b) green (c) yellow (d) black
  40. 40.🎯 Which CSS selector matches this element?
    <div class="big" id="hero">Hello</div>
    (a) .hero (b) #top (c) .big (d) #big

Answer key

  1. Yes
  2. rounds box corners
  3. white
  4. border
  5. background-color
  6. #ff0000
  7. packs boxes at the start
  8. 36
  9. 210
  10. flex-direction
  11. HTML
  12. orange
  13. .
  14. <h2 class="box">
  15. red
  16. #ff00ff
  17. <style>
  18. yellow
  19. 12
  20. Yes
  21. 10
  22. purple
  23. background-color
  24. colours behind the text
  25. 8px
  26. adds space around boxes
  27. Cascading Style Sheets
  28. puts a picture on a page
  29. 326
  30. red
  31. color
  32. purple
  33. 170
  34. the later one
  35. purple
  36. <div id="top">
  37. yellow
  38. 22
  39. black
  40. .big

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