← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 701 · 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.✍️ CSS declarations go inside which brackets? (a) < > (b) ( ) (c) { } (d) [ ]
  2. 2.Which of these is the border? (a) space inside the border (b) the gap to other boxes (c) the line round the box (d) the gap round content
  3. 3.✍️ Which property is set to center in this rule?
    p {
      text-align: center;
      color: red;
    }
    (a) background-color (b) text-align (c) center (d) margin
  4. 4.Which of these does JavaScript do? (a) makes a link (b) lays out the page (c) makes headings and lists (d) checks a quiz answer
  5. 5.🌈 In #000069 the blue part is the hex number 69. What is it as a normal number?
  6. 6.🧩 Which language shows a pop-up message? (a) CSS (b) JavaScript (c) HTML
  7. 7.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 6 (b) 4 (c) 3 (d) 2
  8. 8.What does justify-content: space-between 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
  9. 9.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 12px;
      }
    }
    (a) Yes (b) No
  10. 10.⚖️ 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
  11. 11.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 10px;
      }
    }
    (a) No (b) Yes
  12. 12.🖌️ Which CSS property colours behind the text? (a) color (b) background-color (c) font-weight (d) font-size
  13. 13.🖌️ What colour are the letters?
    p {
      text-align: center;
      font-size: 16px;
      background-color: blue;
      color: red;
    }
    (a) orange (b) blue (c) red
  14. 14.🧩 Which language checks a quiz answer? (a) JavaScript (b) CSS (c) HTML
  15. 15.✍️ How many declarations (property: value pairs) are in this rule?
    body {
      padding: 8px;
      color: red;
    }
  16. 16.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 8px;
      }
    }
    (a) No (b) Yes
  17. 17.💪 Which justify-content value equal gaps, none at ends? (a) space-between (b) flex-end (c) flex-start (d) center
  18. 18.True or false: HTML makes a form box. (a) False (b) True
  19. 19.✍️ In color: blue; which part is the property? (a) ; (b) blue (c) : (d) color
  20. 20.🌈 In #rrggbb, which colour do the last two digits give? (a) white (b) blue (c) green (d) red
  21. 21.🎨 A CSS file usually ends with which extension? (a) .js (b) .png (c) .html (d) .css
  22. 22.🔍 Which is the odd one out? (a) lays out the page (b) sets colours and fonts (c) reacts to a button click (d) rounds box corners
  23. 23.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 180px;
      padding: 15px;
      border: 2px solid black;
      margin: 5px;
    }
  24. 24.🖌️ Which CSS property picks the font style? (a) font-family (b) color (c) font-size (d) background-color
  25. 25.✍️ How many declarations (property: value pairs) are in this rule?
    .note {
      font-size: 20px;
      margin: 10px;
      text-align: center;
      background-color: yellow;
    }
  26. 26.✍️ What is the selector in this CSS rule?
    #top {
      border: 2px solid;
      text-align: center;
    }
    (a) #top (b) center (c) li (d) border
  27. 27.🎯 Which CSS selector matches this element?
    <p class="menu" id="hero">Hello</p>
    (a) h1 (b) #hero (c) #top (d) .note
  28. 28.🖌️ What colour are the letters?
    h2 {
      font-size: 12px;
      text-align: left;
      color: red;
      background-color: orange;
    }
    (a) red (b) orange (c) green
  29. 29.🎯 Can many elements share the same class? (a) No (b) Yes
  30. 30.✍️ How does a CSS comment start? (a) <!-- (b) // (c) /* (d) #
  31. 31.🎯 What kind of selector is #end? (a) a class selector (b) an id selector (c) an element selector
  32. 32.📱 min-width: 800px applies when the screen is ___. (a) turned off (b) exactly 100px (c) 800px or narrower (d) 800px or wider
  33. 33.🎨 What does CSS stand for? (a) Computer Style Sheets (b) Cascading Style Sheets (c) Creative Sheet System (d) Colourful Site Styles
  34. 34.🎯 Which element does the selector h2 style? (a) <span id="main"> (b) <h2 class="box"> (c) <div class="box"> (d) <li>
  35. 35.✍️ How many declarations (property: value pairs) are in this rule?
    h2 {
      margin: 10px;
      border: 2px solid;
      font-weight: bold;
      padding: 8px;
    }
  36. 36.🌈 Which colour is rgb(0, 0, 255)? (a) magenta (b) black (c) bright green (d) blue
  37. 37.True or false: HTML puts a picture on a page. (a) False (b) True
  38. 38.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
  39. 39.✍️ What is the selector in this CSS rule?
    .box {
      background-color: yellow;
      margin: 10px;
      font-weight: bold;
      font-style: italic;
    }
    (a) h2 (b) 10px (c) .box (d) background-color
  40. 40.📱 The screen is 414px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 30px;
      }
    }
    (a) No (b) Yes

Answer key

  1. { }
  2. the line round the box
  3. text-align
  4. checks a quiz answer
  5. 105
  6. JavaScript
  7. 3
  8. equal gaps, none at ends
  9. Yes
  10. the later one
  11. Yes
  12. background-color
  13. red
  14. JavaScript
  15. 2
  16. Yes
  17. space-between
  18. True
  19. color
  20. blue
  21. .css
  22. reacts to a button click
  23. 224
  24. font-family
  25. 4
  26. #top
  27. #hero
  28. red
  29. Yes
  30. /*
  31. an id selector
  32. 800px or wider
  33. Cascading Style Sheets
  34. <h2 class="box">
  35. 4
  36. blue
  37. True
  38. packs boxes at the end
  39. .box
  40. No

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