← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 609 · 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.What does font-family do? (a) picks the font style (b) sets the letter colour (c) makes letters bigger (d) makes the text bold
  2. 2.📦 In the box model, which part is the gap round content? (a) padding (b) content (c) margin (d) border
  3. 3.✍️ Which property is set to italic in this rule?
    p {
      font-style: italic;
      font-size: 20px;
    }
    (a) color (b) font-size (c) font-style (d) italic
  4. 4.True or false: CSS shows a pop-up message. (a) False (b) True
  5. 5.✍️ What value is given to padding in this rule?
    p {
      padding: 8px;
      border: 2px solid;
    }
    (a) 8px (b) bold (c) 2px solid (d) padding
  6. 6.🔍 Which is the odd one out? (a) gives the page structure (b) changes the page live (c) makes a form box (d) makes a link
  7. 7.🌈 In #000d00 the green part is the hex number 0d. What is it as a normal number?
  8. 8.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 180px;
      justify-content: flex-end;
    }
    Inside are 2 boxes, each 80px wide (no margins).
  9. 9.🖌️ What colour are the letters?
    h1 {
      font-size: 20px;
      color: black;
      background-color: purple;
      text-align: left;
    }
    (a) black (b) red (c) purple
  10. 10.🌈 Which hex code is yellow? (a) #00ff00 (b) #ffff00 (c) #000000 (d) #ff0000
  11. 11.True or false: li is an element selector. (a) False (b) True
  12. 12.🎨 One CSS file can style how many pages? (a) no pages (b) only one word (c) only one image (d) many pages
  13. 13.True or false: padding is space inside the border. (a) False (b) True
  14. 14.✍️ CSS declarations go inside which brackets? (a) < > (b) { } (c) ( ) (d) [ ]
  15. 15.🌈 Which colour of light is strongest in rgb(176, 69, 50)? (a) blue (b) green (c) red
  16. 16.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 380px;
      justify-content: space-between;
    }
    Inside are 4 boxes, each 50px wide (no margins).
  17. 17.🎯 Which element does the selector .big style? (a) <span class="red"> (b) <span id="big"> (c) <p class="box"> (d) <span class="big">
  18. 18.📱 The screen is 1366px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 18px;
      }
    }
    (a) Yes (b) No
  19. 19.What does font-size do? (a) sets the letter colour (b) makes letters bigger (c) colours behind the text (d) picks the font style
  20. 20.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 300px;
      justify-content: flex-start;
    }
    Inside are 4 boxes, each 60px wide (no margins).
  21. 21.✍️ What is the selector in this CSS rule?
    li {
      margin: 10px;
      text-align: center;
      font-weight: bold;
    }
    (a) li (b) body (c) center (d) margin
  22. 22.🌈 In #540000 the red part is the hex number 54. What is it as a normal number?
  23. 23.🧩 Which language shows a pop-up message? (a) JavaScript (b) CSS (c) HTML
  24. 24.💪 Which justify-content value packs boxes at the end? (a) flex-end (b) space-between (c) flex-start (d) center
  25. 25.🌈 What is the biggest number one colour can have in rgb()? (a) 100 (b) 1000 (c) 255 (d) 99
  26. 26.🔍 Which is the odd one out? (a) adds space around boxes (b) counts down a timer (c) sets colours and fonts (d) changes the text size
  27. 27.📱 min-width: 800px applies when the screen is ___. (a) 800px or wider (b) turned off (c) 800px or narrower (d) exactly 100px
  28. 28.Which of these does CSS do? (a) makes a form box (b) makes headings and lists (c) adds space around boxes (d) shows a pop-up message
  29. 29.🌈 Which colour of light is strongest in rgb(124, 20, 151)? (a) red (b) blue (c) green
  30. 30.✍️ How many declarations (property: value pairs) are in this rule?
    #top {
      font-size: 20px;
      font-style: italic;
      text-align: center;
    }
  31. 31.🎯 What kind of selector is h1? (a) an element selector (b) a class selector (c) an id selector
  32. 32.🎯 Which CSS selector matches this element?
    <div class="red" id="hero">Hello</div>
    (a) .hero (b) #top (c) #hero (d) .box
  33. 33.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 18px;
      }
    }
  34. 34.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 10px;
      }
    }
  35. 35.⚖️ What colour is the text of this element?
    <h2 class="box" id="intro">Hi</h2>
    CSS:
    h2 { color: orange; }
    h2 { color: blue; }
    (a) blue (b) red (c) green (d) orange
  36. 36.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 8px;
      }
    }
  37. 37.🖌️ What colour is behind the letters?
    h1 {
      font-size: 28px;
      text-align: right;
      background-color: orange;
      color: red;
    }
    (a) white (b) orange (c) red
  38. 38.Which of these does HTML do? (a) lays out the page (b) adds space around boxes (c) reacts to a button click (d) makes a form box
  39. 39.✍️ How does a CSS comment start? (a) # (b) // (c) /* (d) <!--
  40. 40.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 420px;
      justify-content: space-between;
    }
    Inside are 3 boxes, each 100px wide (no margins).

Answer key

  1. picks the font style
  2. padding
  3. font-style
  4. False
  5. 8px
  6. changes the page live
  7. 13
  8. 20
  9. black
  10. #ffff00
  11. True
  12. many pages
  13. True
  14. { }
  15. red
  16. 60
  17. <span class="big">
  18. No
  19. makes letters bigger
  20. 60
  21. li
  22. 84
  23. JavaScript
  24. flex-end
  25. 255
  26. counts down a timer
  27. 800px or wider
  28. adds space around boxes
  29. blue
  30. 3
  31. an element selector
  32. #hero
  33. 18
  34. 10
  35. blue
  36. 12
  37. orange
  38. makes a form box
  39. /*
  40. 60

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