← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 975 · 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 kind of selector is li? (a) an id selector (b) an element selector (c) a class selector
  2. 2.💪 Which flexbox property lines boxes up across? (a) display: flex (b) align-items (c) gap (d) justify-content
  3. 3.🖌️ Where does the text sit on its line?
    h1 {
      background-color: white;
      text-align: left;
      color: yellow;
      font-size: 24px;
    }
    (a) in the middle (b) on the left (c) on the right
  4. 4.True or false: HTML makes a form box. (a) False (b) True
  5. 5.🎯 Which element does the selector p style? (a) <h2 class="red"> (b) <p class="red"> (c) <h1> (d) <li id="logo">
  6. 6.⚖️ What colour is the text of this element?
    <h1 class="big" id="top">Hi</h1>
    CSS:
    #top { color: green; }
    #top { color: red; }
    (a) black (b) orange (c) green (d) red
  7. 7.💪 Which justify-content value packs boxes at the start? (a) flex-start (b) space-between (c) center (d) flex-end
  8. 8.True or false: .big is a class selector. (a) False (b) True
  9. 9.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 250px;
      padding: 30px;
      border: 1px solid black;
      margin: 15px;
    }
  10. 10.✍️ How does a CSS comment start? (a) /* (b) # (c) <!-- (d) //
  11. 11.⚖️ What colour is the text of this element?
    <h1 class="red" id="logo">Hi</h1>
    CSS:
    .red { color: blue; }
    .red { color: red; }
    (a) yellow (b) blue (c) orange (d) red
  12. 12.🎯 Can many elements share the same class? (a) No (b) Yes
  13. 13.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 6 (b) 4 (c) 3 (d) 2
  14. 14.True or false: padding is space inside the border. (a) True (b) False
  15. 15.📱 The screen is 1366px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 18px;
      }
    }
    (a) No (b) Yes
  16. 16.What does color do? (a) picks the font style (b) colours behind the text (c) centres a heading (d) sets the letter colour
  17. 17.✍️ What is the selector in this CSS rule?
    .note {
      border: 2px solid;
      padding: 8px;
    }
    (a) border (b) #top (c) 8px (d) .note
  18. 18.🌈 In #000200 the green part is the hex number 02. What is it as a normal number?
  19. 19.🧩 Which language shows a pop-up message? (a) HTML (b) JavaScript (c) CSS
  20. 20.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 28px;
      }
    }
  21. 21.True or false: CSS changes the page live. (a) False (b) True
  22. 22.⚖️ What colour is the text of this element?
    <h1 class="big" id="intro">Hi</h1>
    CSS:
    #intro { color: red; }
    .big { color: yellow; }
    (a) yellow (b) purple (c) orange (d) red
  23. 23.✍️ Which property is set to 2px solid in this rule?
    .box {
      font-size: 20px;
      width: 300px;
      color: red;
      border: 2px solid;
    }
    (a) font-style (b) width (c) 2px solid (d) border
  24. 24.⚖️ What colour is the text of this element?
    <h2 class="box" id="main">Hi</h2>
    CSS:
    #main { color: black; }
    h2 { color: yellow; }
    (a) black (b) green (c) yellow (d) purple
  25. 25.True or false: h1 is an id selector. (a) True (b) False
  26. 26.True or false: margin is the gap round content. (a) False (b) True
  27. 27.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
  28. 28.🎯 Which CSS selector matches this element?
    <h1 class="star" id="intro">Hello</h1>
    (a) .menu (b) h2 (c) .star (d) #main
  29. 29.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 190px;
      justify-content: flex-end;
    }
    Inside are 4 boxes, each 40px wide (no margins).
  30. 30.✍️ In color: blue; which part is the property? (a) color (b) : (c) ; (d) blue
  31. 31.🎯 What kind of selector is .star? (a) a class selector (b) an element selector (c) an id selector
  32. 32.True or false: JavaScript rounds box corners. (a) False (b) True
  33. 33.⚖️ What colour is the text of this element?
    <p class="note" id="logo">Hi</p>
    CSS:
    p { color: orange; }
    p { color: red; }
    (a) blue (b) red (c) orange (d) purple
  34. 34.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 10px;
      }
    }
    (a) Yes (b) No
  35. 35.Which of these is margin? (a) a solid or dotted edge (b) space outside the border (c) the gap round content (d) the text or picture
  36. 36.True or false: padding is the gap round content. (a) False (b) True
  37. 37.🖌️ Where does the text sit on its line?
    li {
      background-color: black;
      color: red;
      text-align: left;
      font-size: 24px;
    }
    (a) in the middle (b) on the left (c) on the right
  38. 38.✍️ Which sign goes between a property and its value? (a) ; (b) - (c) = (d) :
  39. 39.Which of these does HTML do? (a) rounds box corners (b) makes headings and lists (c) shows a pop-up message (d) reacts to a button click
  40. 40.⚖️ What colour is the text of this element?
    <p class="red" id="intro">Hi</p>
    CSS:
    .red { color: yellow; }
    .red { color: white; }
    (a) yellow (b) green (c) orange (d) white

Answer key

  1. an element selector
  2. align-items
  3. on the left
  4. True
  5. <p class="red">
  6. red
  7. flex-start
  8. True
  9. 342
  10. /*
  11. red
  12. Yes
  13. 3
  14. True
  15. No
  16. sets the letter colour
  17. .note
  18. 2
  19. JavaScript
  20. 24
  21. False
  22. red
  23. border
  24. black
  25. False
  26. False
  27. packs boxes at the start
  28. .star
  29. 30
  30. color
  31. a class selector
  32. False
  33. red
  34. Yes
  35. space outside the border
  36. True
  37. on the left
  38. :
  39. makes headings and lists
  40. white

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