← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 774 · 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.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 130px;
      padding: 10px;
      border: 4px solid black;
      margin: 0px;
    }
  2. 2.🧩 Which language checks a quiz answer? (a) HTML (b) CSS (c) JavaScript
  3. 3.⚖️ What colour is the text of this element?
    <p class="box" id="intro">Hi</p>
    CSS:
    .box { color: black; }
    p { color: purple; }
    #intro { color: blue; }
    (a) black (b) purple (c) green (d) blue
  4. 4.🌈 Hex digits go 0 to 9, then A to which letter? (a) Z (b) G (c) J (d) F
  5. 5.🌈 What is the biggest number one colour can have in rgb()? (a) 99 (b) 255 (c) 100 (d) 1000
  6. 6.⚖️ What colour is the text of this element?
    <p class="red" id="intro">Hi</p>
    CSS:
    #intro { color: yellow; }
    #intro { color: black; }
    (a) yellow (b) black (c) purple (d) red
  7. 7.🖌️ What colour are the letters?
    h1 {
      text-align: center;
      color: blue;
      font-size: 40px;
      background-color: red;
    }
    (a) red (b) black (c) blue
  8. 8.💪 Which flexbox property turns on flexbox? (a) display: flex (b) align-items (c) flex-direction (d) gap
  9. 9.🧩 Which language reacts to a button click? (a) JavaScript (b) CSS (c) HTML
  10. 10.📦 In the box model, which part is a solid or dotted edge? (a) margin (b) content (c) border (d) padding
  11. 11.🌈 Which colour of light is strongest in rgb(109, 132, 157)? (a) red (b) green (c) blue
  12. 12.⚖️ What colour is the text of this element?
    <h1 class="box" id="hero">Hi</h1>
    CSS:
    h1 { color: yellow; }
    #hero { color: purple; }
    .box { color: orange; }
    (a) purple (b) orange (c) yellow (d) black
  13. 13.🎨 What does CSS stand for? (a) Computer Style Sheets (b) Colourful Site Styles (c) Creative Sheet System (d) Cascading Style Sheets
  14. 14.✍️ What value is given to background-color in this rule?
    .note {
      border: 2px solid;
      font-style: italic;
      background-color: yellow;
      margin: 10px;
    }
    (a) 10px (b) background-color (c) yellow (d) 8px
  15. 15.🌈 In #rrggbb, which colour do the first two digits give? (a) blue (b) black (c) green (d) red
  16. 16.🎨 Which tag connects an outside CSS file? (a) <css> (b) <a> (c) <img> (d) <link>
  17. 17.True or false: padding is a solid or dotted edge. (a) False (b) True
  18. 18.Which of these is margin? (a) the text or picture (b) the gap round content (c) a solid or dotted edge (d) space outside the border
  19. 19.🖌️ Which CSS property sets the letter colour? (a) background-color (b) font-family (c) text-align (d) color
  20. 20.🌈 Which colour of light is strongest in rgb(136, 201, 33)? (a) red (b) green (c) blue
  21. 21.🌈 Which colour is rgb(0, 255, 0)? (a) blue (b) bright green (c) magenta (d) white
  22. 22.🎯 What kind of selector is img? (a) an element selector (b) a class selector (c) an id selector
  23. 23.🎯 What kind of selector is .star? (a) a class selector (b) an element selector (c) an id selector
  24. 24.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 3 (b) 4 (c) 6 (d) 2
  25. 25.📱 max-width: 600px applies when the screen is ___. (a) 600px or narrower (b) 600px or wider (c) exactly 1000px (d) turned off
  26. 26.⚖️ What colour is the text of this element?
    <h2 class="menu" id="top">Hi</h2>
    CSS:
    .menu { color: blue; }
    .menu { color: red; }
    (a) yellow (b) white (c) red (d) blue
  27. 27.🌈 Which colour is #ff0000? (a) white (b) red (c) black (d) blue
  28. 28.🌈 In #004900 the green part is the hex number 49. What is it as a normal number?
  29. 29.🖌️ Which CSS property makes the text bold? (a) font-family (b) font-size (c) text-align (d) font-weight
  30. 30.True or false: .big is an id selector. (a) True (b) False
  31. 31.💪 Which justify-content value packs boxes at the end? (a) flex-end (b) space-between (c) flex-start (d) center
  32. 32.True or false: CSS counts down a timer. (a) True (b) False
  33. 33.💪 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).
  34. 34.📦 In the box model, which part is the gap to other boxes? (a) margin (b) border (c) padding (d) content
  35. 35.🎯 Which sign starts a class selector? (a) & (b) @ (c) . (d) #
  36. 36.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 6px;
      }
    }
  37. 37.✍️ How many declarations (property: value pairs) are in this rule?
    .box {
      font-style: italic;
      padding: 8px;
      background-color: yellow;
    }
  38. 38.What does justify-content: flex-start do? (a) packs boxes at the end (b) equal gaps, none at ends (c) packs boxes at the start (d) puts boxes in the middle
  39. 39.📱 What does a media query check? (a) the battery level (b) the time of day (c) the screen width (d) the page title
  40. 40.✍️ How many declarations (property: value pairs) are in this rule?
    p {
      font-size: 20px;
      text-align: center;
    }

Answer key

  1. 158
  2. JavaScript
  3. blue
  4. F
  5. 255
  6. black
  7. blue
  8. display: flex
  9. JavaScript
  10. border
  11. blue
  12. purple
  13. Cascading Style Sheets
  14. yellow
  15. red
  16. <link>
  17. False
  18. space outside the border
  19. color
  20. green
  21. bright green
  22. an element selector
  23. a class selector
  24. 3
  25. 600px or narrower
  26. red
  27. red
  28. 73
  29. font-weight
  30. False
  31. flex-end
  32. False
  33. 60
  34. margin
  35. .
  36. 12
  37. 3
  38. packs boxes at the start
  39. the screen width
  40. 2

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