← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 710 · 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.True or false: HTML makes a link. (a) True (b) False
  2. 2.🧩 Which language adds space around boxes? (a) JavaScript (b) HTML (c) CSS
  3. 3.🧩 Which language makes headings and lists? (a) CSS (b) JavaScript (c) HTML
  4. 4.🌈 Which colour is #ff00ff? (a) red (b) white (c) magenta (d) black
  5. 5.🎯 What kind of selector is body? (a) an element selector (b) a class selector (c) an id selector
  6. 6.🧩 Which language puts a picture on a page? (a) CSS (b) JavaScript (c) HTML
  7. 7.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 210px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 100px wide (no margins).
  8. 8.🌈 Hex digits go 0 to 9, then A to which letter? (a) J (b) Z (c) G (d) F
  9. 9.🌈 Which hex code is black? (a) #ffff00 (b) #ff0000 (c) #000000 (d) #00ffff
  10. 10.🖌️ Which CSS property makes the text bold? (a) text-align (b) background-color (c) color (d) font-weight
  11. 11.🌈 In #002700 the green part is the hex number 27. What is it as a normal number?
  12. 12.✍️ What is the selector in this CSS rule?
    h2 {
      font-size: 20px;
      font-style: italic;
      font-weight: bold;
    }
    (a) italic (b) font-size (c) h2 (d) h1
  13. 13.Which of these does CSS do? (a) gives the page structure (b) sets colours and fonts (c) checks a quiz answer (d) makes a form box
  14. 14.🌈 In #380000 the red part is the hex number 38. What is it as a normal number?
  15. 15.🖌️ Where does the text sit on its line?
    h1 {
      background-color: yellow;
      text-align: left;
      font-size: 16px;
      color: purple;
    }
    (a) on the left (b) in the middle (c) on the right
  16. 16.📱 min-width: 800px applies when the screen is ___. (a) exactly 100px (b) turned off (c) 800px or narrower (d) 800px or wider
  17. 17.✍️ What value is given to text-align in this rule?
    body {
      width: 300px;
      text-align: center;
    }
    (a) text-align (b) center (c) yellow (d) 10px
  18. 18.🌈 In #rrggbb, which colour do the first two digits give? (a) blue (b) red (c) black (d) green
  19. 19.🌈 Which hex code is red? (a) #00ffff (b) #ff0000 (c) #000000 (d) #0000ff
  20. 20.🖌️ What colour are the letters?
    li {
      background-color: red;
      font-size: 16px;
      text-align: right;
      color: yellow;
    }
    (a) red (b) yellow (c) white
  21. 21.🌈 What is the biggest number one colour can have in rgb()? (a) 99 (b) 255 (c) 1000 (d) 100
  22. 22.True or false: img is an element selector. (a) False (b) True
  23. 23.🎯 What kind of selector is .star? (a) an id selector (b) an element selector (c) a class selector
  24. 24.✍️ What value is given to font-weight in this rule?
    body {
      padding: 8px;
      font-size: 20px;
      font-weight: bold;
    }
    (a) 300px (b) bold (c) 2px solid (d) font-weight
  25. 25.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 24px;
      }
    }
  26. 26.📦 In the box model, which part is the gap to other boxes? (a) margin (b) border (c) content (d) padding
  27. 27.🎯 Which CSS selector matches this element?
    <h1 class="red" id="top">Hello</h1>
    (a) .top (b) #intro (c) #red (d) .red
  28. 28.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 230px;
      padding: 5px;
      border: 3px solid black;
      margin: 0px;
    }
  29. 29.⚖️ What colour is the text of this element?
    <h1 class="box" id="end">Hi</h1>
    CSS:
    h1 { color: green; }
    .box { color: blue; }
    (a) green (b) purple (c) blue (d) orange
  30. 30.🌈 In #rrggbb, which colour do the last two digits give? (a) white (b) green (c) red (d) blue
  31. 31.🧩 Which language makes a link? (a) CSS (b) JavaScript (c) HTML
  32. 32.🖌️ Which CSS property makes letters bigger? (a) text-align (b) background-color (c) font-weight (d) font-size
  33. 33.💪 Which flexbox property sets space between boxes? (a) justify-content (b) display: flex (c) gap (d) flex-direction
  34. 34.True or false: .star is a class selector. (a) True (b) False
  35. 35.True or false: body is an id selector. (a) True (b) False
  36. 36.✍️ How does a CSS comment start? (a) # (b) // (c) <!-- (d) /*
  37. 37.📱 The screen is 820px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 10px;
      }
    }
    (a) Yes (b) No
  38. 38.🖌️ Which CSS property colours behind the text? (a) font-size (b) text-align (c) background-color (d) font-weight
  39. 39.🌈 Which colour is rgb(0, 0, 255)? (a) black (b) bright green (c) blue (d) red
  40. 40.True or false: CSS gives the page structure. (a) False (b) True

Answer key

  1. True
  2. CSS
  3. HTML
  4. magenta
  5. an element selector
  6. HTML
  7. 10
  8. F
  9. #000000
  10. font-weight
  11. 39
  12. h2
  13. sets colours and fonts
  14. 56
  15. on the left
  16. 800px or wider
  17. center
  18. red
  19. #ff0000
  20. yellow
  21. 255
  22. True
  23. a class selector
  24. bold
  25. 24
  26. margin
  27. .red
  28. 246
  29. blue
  30. blue
  31. HTML
  32. font-size
  33. gap
  34. True
  35. False
  36. /*
  37. No
  38. background-color
  39. blue
  40. False

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