← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 109 · 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 colour is #00ff00? (a) white (b) black (c) yellow (d) bright green
  2. 2.🌈 In #009a00 the green part is the hex number 9a. What is it as a normal number?
  3. 3.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the first one (b) the shorter one (c) neither (d) the later one
  4. 4.🔍 Which is the odd one out? (a) lays out the page (b) shows a pop-up message (c) sets colours and fonts (d) changes the text size
  5. 5.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 290px;
      padding: 30px;
      border: 5px solid black;
      margin: 0px;
    }
  6. 6.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 380px;
      justify-content: space-between;
    }
    Inside are 3 boxes, each 100px wide (no margins).
  7. 7.🌈 Which colour of light is strongest in rgb(121, 122, 161)? (a) red (b) green (c) blue
  8. 8.💪 Which flexbox property lines boxes up across? (a) display: flex (b) align-items (c) gap (d) justify-content
  9. 9.✍️ Which property is set to 8px in this rule?
    .note {
      font-weight: bold;
      padding: 8px;
    }
    (a) padding (b) font-weight (c) border (d) 8px
  10. 10.🌈 Which colour is rgb(255, 0, 255)? (a) red (b) white (c) blue (d) magenta
  11. 11.True or false: .star is an element selector. (a) True (b) False
  12. 12.🔍 Which is the odd one out? (a) reacts to a button click (b) adds space around boxes (c) shows a pop-up message (d) counts down a timer
  13. 13.Which of these does CSS do? (a) changes the page live (b) puts a picture on a page (c) rounds box corners (d) counts down a timer
  14. 14.📱 What does a media query check? (a) the battery level (b) the page title (c) the time of day (d) the screen width
  15. 15.Which of these does JavaScript do? (a) makes a form box (b) makes a link (c) changes the page live (d) puts a picture on a page
  16. 16.Which of these is margin? (a) the gap round content (b) space outside the border (c) the text or picture (d) the line round the box
  17. 17.📱 min-width: 800px applies when the screen is ___. (a) 800px or narrower (b) exactly 100px (c) turned off (d) 800px or wider
  18. 18.📱 The screen is 1366px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 18px;
      }
    }
    (a) No (b) Yes
  19. 19.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 120px;
      padding: 10px;
      border: 4px solid black;
      margin: 0px;
    }
  20. 20.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 60px;
      padding: 5px;
      border: 3px solid black;
      margin: 10px;
    }
  21. 21.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 16px;
      }
    }
  22. 22.🔍 Which is the odd one out? (a) reacts to a button click (b) counts down a timer (c) makes a form box (d) changes the page live
  23. 23.⚖️ What colour is the text of this element?
    <p class="menu" id="top">Hi</p>
    CSS:
    #top { color: green; }
    #top { color: red; }
    (a) orange (b) green (c) red (d) purple
  24. 24.Which of these does JavaScript do? (a) makes a form box (b) lays out the page (c) rounds box corners (d) reacts to a button click
  25. 25.🖌️ What colour is behind the letters?
    h1 {
      text-align: right;
      font-size: 40px;
      color: orange;
      background-color: green;
    }
    (a) orange (b) green (c) yellow
  26. 26.✍️ What value is given to margin in this rule?
    h1 {
      padding: 8px;
      margin: 10px;
    }
    (a) margin (b) bold (c) 10px (d) 8px
  27. 27.🎯 What kind of selector is .note? (a) a class selector (b) an id selector (c) an element selector
  28. 28.🎯 Which element does the selector li style? (a) <div> (b) <p id="hero"> (c) <li class="big"> (d) <span class="big">
  29. 29.🎯 Which element does the selector h1 style? (a) <h1 class="big"> (b) <li class="big"> (c) <h2> (d) <div id="end">
  30. 30.✍️ CSS declarations go inside which brackets? (a) { } (b) < > (c) ( ) (d) [ ]
  31. 31.⚖️ What colour is the text of this element?
    <h1 class="box" id="hero">Hi</h1>
    CSS:
    #hero { color: blue; }
    #hero { color: green; }
    (a) purple (b) white (c) green (d) blue
  32. 32.✍️ How many declarations (property: value pairs) are in this rule?
    p {
      font-size: 20px;
      font-style: italic;
      font-weight: bold;
      width: 300px;
    }
  33. 33.True or false: CSS makes a form box. (a) False (b) True
  34. 34.📱 Responsive design means a page ___. (a) fits every screen (b) never changes (c) is only for laptops (d) has no pictures
  35. 35.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 10px;
      }
    }
  36. 36.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 340px;
      justify-content: space-between;
    }
    Inside are 3 boxes, each 60px wide (no margins).
  37. 37.What does background-color do? (a) centres a heading (b) makes letters bigger (c) makes the text bold (d) colours behind the text
  38. 38.True or false: p is an id selector. (a) True (b) False
  39. 39.Which of these does CSS do? (a) puts a picture on a page (b) makes a link (c) lays out the page (d) checks a quiz answer
  40. 40.✍️ In color: blue; which part is the value? (a) ; (b) color (c) blue (d) :

Answer key

  1. bright green
  2. 154
  3. the later one
  4. shows a pop-up message
  5. 360
  6. 40
  7. blue
  8. align-items
  9. padding
  10. magenta
  11. False
  12. adds space around boxes
  13. rounds box corners
  14. the screen width
  15. changes the page live
  16. space outside the border
  17. 800px or wider
  18. Yes
  19. 148
  20. 96
  21. 16
  22. makes a form box
  23. red
  24. reacts to a button click
  25. green
  26. 10px
  27. a class selector
  28. <li class="big">
  29. <h1 class="big">
  30. { }
  31. green
  32. 4
  33. False
  34. fits every screen
  35. 10
  36. 80
  37. colours behind the text
  38. False
  39. lays out the page
  40. blue

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