← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 996 · 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 selector is the strongest? (a) a class selector (b) an id selector (c) an element selector
  2. 2.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 2 (b) 6 (c) 3 (d) 4
  3. 3.🎯 Which element does the selector p style? (a) <p class="big"> (b) <h2 class="big"> (c) <li id="main"> (d) <h1>
  4. 4.🖌️ What colour is behind the letters?
    li {
      background-color: white;
      text-align: center;
      font-size: 40px;
      color: black;
    }
    (a) green (b) black (c) white
  5. 5.Which of these is the border? (a) space inside the border (b) the gap to other boxes (c) a solid or dotted edge (d) the text or picture
  6. 6.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 50px;
      padding: 10px;
      border: 3px solid black;
      margin: 0px;
    }
  7. 7.Which of these is margin? (a) space outside the border (b) the text or picture (c) a solid or dotted edge (d) space inside the border
  8. 8.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 260px;
      justify-content: center;
    }
    Inside are 3 boxes, each 80px wide (no margins).
  9. 9.💪 Which flexbox property sets space between boxes? (a) gap (b) justify-content (c) align-items (d) flex-direction
  10. 10.True or false: CSS lays out the page. (a) False (b) True
  11. 11.🧩 Which language checks a quiz answer? (a) CSS (b) HTML (c) JavaScript
  12. 12.✍️ Which property is set to 300px in this rule?
    p {
      padding: 8px;
      width: 300px;
    }
    (a) font-style (b) color (c) 300px (d) width
  13. 13.🌈 What is the biggest number one colour can have in rgb()? (a) 99 (b) 1000 (c) 255 (d) 100
  14. 14.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the shorter one (b) the later one (c) the first one (d) neither
  15. 15.True or false: margin is the gap to other boxes. (a) False (b) True
  16. 16.✍️ What is the selector in this CSS rule?
    p {
      text-align: center;
      font-size: 20px;
      font-style: italic;
      border: 2px solid;
    }
    (a) 20px (b) text-align (c) .note (d) p
  17. 17.✍️ How many declarations (property: value pairs) are in this rule?
    .note {
      padding: 8px;
      font-style: italic;
    }
  18. 18.💪 Which justify-content value puts boxes in the middle? (a) flex-end (b) center (c) flex-start (d) space-between
  19. 19.🎨 What does CSS stand for? (a) Creative Sheet System (b) Computer Style Sheets (c) Cascading Style Sheets (d) Colourful Site Styles
  20. 20.🔍 Which is the odd one out? (a) rounds box corners (b) makes headings and lists (c) makes a link (d) makes a form box
  21. 21.⚖️ What colour is the text of this element?
    <h1 class="box" id="hero">Hi</h1>
    CSS:
    .box { color: black; }
    #hero { color: blue; }
    h1 { color: green; }
    (a) blue (b) black (c) green (d) white
  22. 22.🌈 Which colour is #ffff00? (a) bright green (b) yellow (c) black (d) blue
  23. 23.⚖️ What colour is the text of this element?
    <h2 class="menu" id="top">Hi</h2>
    CSS:
    #top { color: blue; }
    #top { color: white; }
    (a) white (b) yellow (c) red (d) blue
  24. 24.🎯 Which CSS selector matches this element?
    <h1 class="note" id="end">Hello</h1>
    (a) h2 (b) #hero (c) .big (d) #end
  25. 25.✍️ What is the selector in this CSS rule?
    body {
      font-style: italic;
      width: 300px;
      font-weight: bold;
      border: 2px solid;
    }
    (a) body (b) 300px (c) font-style (d) .box
  26. 26.🌈 In #2c0000 the red part is the hex number 2c. What is it as a normal number?
  27. 27.✍️ Which sign goes between a property and its value? (a) : (b) - (c) = (d) ;
  28. 28.What does text-align do? (a) colours behind the text (b) sets the letter colour (c) makes letters bigger (d) centres a heading
  29. 29.✍️ Which property is set to 2px solid in this rule?
    p {
      border: 2px solid;
      padding: 8px;
      font-style: italic;
      width: 300px;
    }
    (a) 2px solid (b) width (c) border (d) font-style
  30. 30.What does font-family do? (a) makes the text bold (b) centres a heading (c) makes letters bigger (d) picks the font style
  31. 31.🖌️ Which CSS property sets the letter colour? (a) font-weight (b) color (c) font-size (d) background-color
  32. 32.📦 In the box model, which part is space inside the border? (a) border (b) margin (c) padding (d) content
  33. 33.🎯 Which CSS selector matches this element?
    <p class="menu" id="intro">Hello</p>
    (a) .note (b) #main (c) #menu (d) p
  34. 34.🎯 Can many elements share the same class? (a) Yes (b) No
  35. 35.🖌️ How big is the text, in px?
    p {
      background-color: green;
      color: orange;
      font-size: 24px;
      text-align: right;
    }
  36. 36.🧩 Which language gives the page structure? (a) JavaScript (b) CSS (c) HTML
  37. 37.📱 max-width: 600px applies when the screen is ___. (a) turned off (b) 600px or narrower (c) exactly 1000px (d) 600px or wider
  38. 38.🎨 Which tag connects an outside CSS file? (a) <a> (b) <img> (c) <link> (d) <css>
  39. 39.⚖️ What colour is the text of this element?
    <h2 class="box" id="end">Hi</h2>
    CSS:
    .box { color: orange; }
    .box { color: white; }
    (a) orange (b) green (c) white (d) yellow
  40. 40.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 28px;
      }
    }

Answer key

  1. an id selector
  2. 3
  3. <p class="big">
  4. white
  5. a solid or dotted edge
  6. 76
  7. space outside the border
  8. 10
  9. gap
  10. True
  11. JavaScript
  12. width
  13. 255
  14. the later one
  15. True
  16. p
  17. 2
  18. center
  19. Cascading Style Sheets
  20. rounds box corners
  21. blue
  22. yellow
  23. white
  24. #end
  25. body
  26. 44
  27. :
  28. centres a heading
  29. border
  30. picks the font style
  31. color
  32. padding
  33. p
  34. Yes
  35. 24
  36. HTML
  37. 600px or narrower
  38. <link>
  39. white
  40. 24

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