← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 981 · 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 justify-content value puts boxes in the middle? (a) flex-end (b) space-between (c) center (d) flex-start
  2. 2.⚖️ What colour is the text of this element?
    <h1 class="box" id="logo">Hi</h1>
    CSS:
    #logo { color: purple; }
    .box { color: yellow; }
    (a) yellow (b) red (c) purple (d) green
  3. 3.✍️ Which property is set to 10px in this rule?
    .note {
      margin: 10px;
      color: red;
      background-color: yellow;
      font-size: 20px;
    }
    (a) 10px (b) margin (c) padding (d) font-weight
  4. 4.🖌️ What colour are the letters?
    p {
      text-align: left;
      color: blue;
      font-size: 20px;
      background-color: white;
    }
    (a) blue (b) black (c) white
  5. 5.🌈 In #rrggbb, which colour do the last two digits give? (a) red (b) green (c) white (d) blue
  6. 6.True or false: margin is the gap round content. (a) True (b) False
  7. 7.🎯 How many elements on a page should have the same id? (a) 2 (b) any number (c) 1 (d) 5
  8. 8.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 8px;
      }
    }
    (a) Yes (b) No
  9. 9.🎨 Which tag holds CSS inside the head? (a) <style> (b) <body> (c) <css> (d) <script>
  10. 10.🎯 Which CSS selector matches this element?
    <div class="big" id="intro">Hello</div>
    (a) #intro (b) .intro (c) #big (d) .red
  11. 11.📦 In the box model, which part is the line round the box? (a) content (b) padding (c) margin (d) border
  12. 12.🖌️ Which CSS property makes letters bigger? (a) font-size (b) color (c) font-weight (d) text-align
  13. 13.✍️ Which sign goes between a property and its value? (a) : (b) ; (c) = (d) -
  14. 14.🌈 In #00c300 the green part is the hex number c3. What is it as a normal number?
  15. 15.🌈 Which colour of light is strongest in rgb(57, 44, 159)? (a) blue (b) red (c) green
  16. 16.✍️ Which property is set to 300px in this rule?
    h1 {
      width: 300px;
      color: red;
      font-weight: bold;
    }
    (a) font-style (b) 300px (c) color (d) width
  17. 17.What does font-size do? (a) sets the letter colour (b) makes letters bigger (c) centres a heading (d) picks the font style
  18. 18.📱 Responsive design means a page ___. (a) has no pictures (b) is only for laptops (c) never changes (d) fits every screen
  19. 19.🎯 What kind of selector is h1? (a) an id selector (b) a class selector (c) an element selector
  20. 20.🧩 Which language checks a quiz answer? (a) JavaScript (b) HTML (c) CSS
  21. 21.🔍 Which is the odd one out? (a) changes the page live (b) reacts to a button click (c) adds space around boxes (d) checks a quiz answer
  22. 22.🎯 Which CSS selector matches this element?
    <h1 class="menu" id="main">Hello</h1>
    (a) h1 (b) .note (c) #menu (d) h2
  23. 23.🌈 Which hex code is magenta? (a) #00ff00 (b) #000000 (c) #ffffff (d) #ff00ff
  24. 24.📦 In the box model, which part is the gap to other boxes? (a) content (b) border (c) margin (d) padding
  25. 25.⚖️ What colour is the text of this element?
    <p class="menu" id="top">Hi</p>
    CSS:
    #top { color: yellow; }
    #top { color: black; }
    (a) white (b) blue (c) black (d) yellow
  26. 26.What does font-weight do? (a) centres a heading (b) sets the letter colour (c) makes the text bold (d) picks the font style
  27. 27.True or false: JavaScript gives the page structure. (a) False (b) True
  28. 28.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 170px;
      justify-content: flex-end;
    }
    Inside are 4 boxes, each 40px wide (no margins).
  29. 29.✍️ What is the selector in this CSS rule?
    #top {
      text-align: center;
      color: red;
      font-weight: bold;
      width: 300px;
    }
    (a) red (b) li (c) #top (d) text-align
  30. 30.🧩 Which language lays out the page? (a) HTML (b) JavaScript (c) CSS
  31. 31.🎯 Which element does the selector h1 style? (a) <div id="intro"> (b) <h2> (c) <li class="red"> (d) <h1 class="red">
  32. 32.🎯 Which element does the selector .box style? (a) <div class="star"> (b) <div id="box"> (c) <span class="menu"> (d) <div class="box">
  33. 33.⚖️ What colour is the text of this element?
    <p class="menu" id="intro">Hi</p>
    CSS:
    .menu { color: blue; }
    .menu { color: green; }
    (a) yellow (b) blue (c) green (d) red
  34. 34.⚖️ What colour is the text of this element?
    <h2 class="note" id="logo">Hi</h2>
    CSS:
    .note { color: white; }
    h2 { color: black; }
    (a) black (b) blue (c) purple (d) white
  35. 35.🖌️ Which CSS property picks the font style? (a) font-size (b) font-family (c) text-align (d) color
  36. 36.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 14px;
      }
    }
  37. 37.Which of these does JavaScript do? (a) makes headings and lists (b) makes a form box (c) puts a picture on a page (d) checks a quiz answer
  38. 38.🖌️ What colour are the letters?
    li {
      text-align: left;
      font-size: 12px;
      color: orange;
      background-color: red;
    }
    (a) orange (b) yellow (c) red
  39. 39.⚖️ Which selector is the weakest? (a) a class selector (b) an id selector (c) an element selector
  40. 40.💪 Which justify-content value equal gaps, none at ends? (a) flex-end (b) space-between (c) center (d) flex-start

Answer key

  1. center
  2. purple
  3. margin
  4. blue
  5. blue
  6. False
  7. 1
  8. Yes
  9. <style>
  10. #intro
  11. border
  12. font-size
  13. :
  14. 195
  15. blue
  16. width
  17. makes letters bigger
  18. fits every screen
  19. an element selector
  20. JavaScript
  21. adds space around boxes
  22. h1
  23. #ff00ff
  24. margin
  25. black
  26. makes the text bold
  27. False
  28. 10
  29. #top
  30. CSS
  31. <h1 class="red">
  32. <div class="box">
  33. green
  34. white
  35. font-family
  36. 20
  37. checks a quiz answer
  38. orange
  39. an element selector
  40. space-between

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