← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 385 · 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 element does the selector .big style? (a) <p class="red"> (b) <p class="big"> (c) <h1 class="box"> (d) <p id="big">
  2. 2.🌈 Which hex code is yellow? (a) #000000 (b) #ffffff (c) #ffff00 (d) #ff0000
  3. 3.🔍 Which is the odd one out? (a) changes the page live (b) changes the text size (c) reacts to a button click (d) counts down a timer
  4. 4.✍️ Which property is set to 300px in this rule?
    h2 {
      padding: 8px;
      text-align: center;
      margin: 10px;
      width: 300px;
    }
    (a) color (b) font-style (c) width (d) 300px
  5. 5.📦 In the box model, which part is space outside the border? (a) margin (b) border (c) content (d) padding
  6. 6.🔍 Which is the odd one out? (a) makes headings and lists (b) makes a form box (c) makes a link (d) lays out the page
  7. 7.🌈 Which colour is #ff00ff? (a) red (b) white (c) bright green (d) magenta
  8. 8.🎯 Which element does the selector .box style? (a) <div class="menu"> (b) <li class="box"> (c) <li class="star"> (d) <li id="box">
  9. 9.⚖️ Which selector is the weakest? (a) an id selector (b) a class selector (c) an element selector
  10. 10.🎯 Which element does the selector .box style? (a) <h2 class="menu"> (b) <h1 id="box"> (c) <h1 class="star"> (d) <h1 class="box">
  11. 11.🌈 Which colour is rgb(0, 255, 255)? (a) magenta (b) black (c) cyan (d) red
  12. 12.🖌️ How big is the text, in px?
    h1 {
      color: red;
      text-align: right;
      background-color: orange;
      font-size: 20px;
    }
  13. 13.What does justify-content: space-between do? (a) packs boxes at the end (b) puts boxes in the middle (c) packs boxes at the start (d) equal gaps, none at ends
  14. 14.What does font-size do? (a) sets the letter colour (b) makes letters bigger (c) picks the font style (d) centres a heading
  15. 15.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 20px;
      }
    }
  16. 16.🌈 Which colour is #0000ff? (a) white (b) blue (c) cyan (d) bright green
  17. 17.True or false: padding is space inside the border. (a) True (b) False
  18. 18.✍️ In color: blue; which part is the property? (a) color (b) : (c) ; (d) blue
  19. 19.💪 Which justify-content value packs boxes at the end? (a) center (b) space-between (c) flex-start (d) flex-end
  20. 20.🌈 Which colour is rgb(0, 255, 0)? (a) black (b) blue (c) white (d) bright green
  21. 21.✍️ Which sign ends each CSS declaration? (a) , (b) . (c) : (d) ;
  22. 22.📦 In the box model, which part is the line round the box? (a) border (b) content (c) margin (d) padding
  23. 23.🌈 In #e10000 the red part is the hex number e1. What is it as a normal number?
  24. 24.⚖️ Which selector is the strongest? (a) an id selector (b) an element selector (c) a class selector
  25. 25.🌈 In #009c00 the green part is the hex number 9c. What is it as a normal number?
  26. 26.🌈 Which colour of light is strongest in rgb(27, 160, 32)? (a) blue (b) green (c) red
  27. 27.🎯 Which CSS selector matches this element?
    <div class="red" id="intro">Hello</div>
    (a) .red (b) span (c) #red (d) .intro
  28. 28.True or false: padding is the gap round content. (a) True (b) False
  29. 29.🌈 Which hex code is blue? (a) #ffffff (b) #ff00ff (c) #0000ff (d) #00ffff
  30. 30.⚖️ What colour is the text of this element?
    <h2 class="menu" id="end">Hi</h2>
    CSS:
    #end { color: red; }
    h2 { color: purple; }
    (a) black (b) red (c) white (d) purple
  31. 31.🎨 Which tag holds CSS inside the head? (a) <script> (b) <css> (c) <style> (d) <body>
  32. 32.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 16px;
      }
    }
  33. 33.📱 What does a media query check? (a) the screen width (b) the time of day (c) the page title (d) the battery level
  34. 34.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 20px;
      }
    }
    (a) Yes (b) No
  35. 35.What does justify-content: flex-end do? (a) packs boxes at the start (b) equal gaps, none at ends (c) puts boxes in the middle (d) packs boxes at the end
  36. 36.📱 max-width: 600px applies when the screen is ___. (a) turned off (b) 600px or wider (c) exactly 1000px (d) 600px or narrower
  37. 37.✍️ Which property is set to 20px in this rule?
    body {
      background-color: yellow;
      font-size: 20px;
    }
    (a) background-color (b) 20px (c) text-align (d) font-size
  38. 38.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 180px;
      justify-content: center;
    }
    Inside are 2 boxes, each 60px wide (no margins).
  39. 39.🎯 How many elements on a page should have the same id? (a) 2 (b) any number (c) 5 (d) 1
  40. 40.📱 min-width: 800px applies when the screen is ___. (a) exactly 100px (b) 800px or narrower (c) turned off (d) 800px or wider

Answer key

  1. <p class="big">
  2. #ffff00
  3. changes the text size
  4. width
  5. margin
  6. lays out the page
  7. magenta
  8. <li class="box">
  9. an element selector
  10. <h1 class="box">
  11. cyan
  12. 20
  13. equal gaps, none at ends
  14. makes letters bigger
  15. 16
  16. blue
  17. True
  18. color
  19. flex-end
  20. bright green
  21. ;
  22. border
  23. 225
  24. an id selector
  25. 156
  26. green
  27. .red
  28. True
  29. #0000ff
  30. red
  31. <style>
  32. 16
  33. the screen width
  34. Yes
  35. packs boxes at the end
  36. 600px or narrower
  37. font-size
  38. 30
  39. 1
  40. 800px or wider

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