← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 194 · 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 empty space (px) is before the first box?
    .row {
      display: flex;
      width: 260px;
      justify-content: center;
    }
    Inside are 2 boxes, each 80px wide (no margins).
  2. 2.✍️ Which sign goes between a property and its value? (a) : (b) - (c) ; (d) =
  3. 3.🌈 Which colour is rgb(0, 0, 0)? (a) bright green (b) red (c) white (d) black
  4. 4.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 140px;
      padding: 25px;
      border: 5px solid black;
      margin: 15px;
    }
  5. 5.🎯 Which CSS selector matches this element?
    <div class="big" id="top">Hello</div>
    (a) span (b) .top (c) .big (d) .red
  6. 6.⚖️ What colour is the text of this element?
    <p class="note" id="hero">Hi</p>
    CSS:
    p { color: blue; }
    p { color: green; }
    (a) white (b) green (c) blue (d) yellow
  7. 7.True or false: .star is a class selector. (a) False (b) True
  8. 8.⚖️ What colour is the text of this element?
    <h2 class="big" id="top">Hi</h2>
    CSS:
    .big { color: white; }
    .big { color: red; }
    (a) purple (b) white (c) orange (d) red
  9. 9.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 190px;
      padding: 30px;
      border: 3px solid black;
      margin: 20px;
    }
  10. 10.🌈 In #rrggbb, which colour do the first two digits give? (a) black (b) red (c) blue (d) green
  11. 11.✍️ How many declarations (property: value pairs) are in this rule?
    .box {
      font-style: italic;
      text-align: center;
    }
  12. 12.True or false: HTML makes a form box. (a) False (b) True
  13. 13.⚖️ Two rules with the same selector set a colour. Which one wins? (a) neither (b) the shorter one (c) the later one (d) the first one
  14. 14.⚖️ What colour is the text of this element?
    <p class="box" id="top">Hi</p>
    CSS:
    #top { color: red; }
    p { color: blue; }
    .box { color: orange; }
    (a) blue (b) red (c) orange (d) white
  15. 15.💪 Which justify-content value puts boxes in the middle? (a) center (b) flex-start (c) space-between (d) flex-end
  16. 16.🎯 What kind of selector is #hero? (a) a class selector (b) an element selector (c) an id selector
  17. 17.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 24px;
      }
    }
  18. 18.True or false: the border is the gap round content. (a) False (b) True
  19. 19.✍️ How does a CSS comment start? (a) // (b) <!-- (c) /* (d) #
  20. 20.🖌️ Which CSS property makes letters bigger? (a) font-size (b) text-align (c) color (d) font-weight
  21. 21.🎨 Which tag holds CSS inside the head? (a) <script> (b) <style> (c) <css> (d) <body>
  22. 22.🎯 Which CSS selector matches this element?
    <div class="note" id="top">Hello</div>
    (a) #top (b) span (c) #intro (d) #note
  23. 23.True or false: JavaScript makes a form box. (a) True (b) False
  24. 24.True or false: #main is a class selector. (a) False (b) True
  25. 25.⚖️ What colour is the text of this element?
    <h2 class="note" id="end">Hi</h2>
    CSS:
    .note { color: green; }
    .note { color: blue; }
    (a) purple (b) green (c) orange (d) blue
  26. 26.🎯 Which CSS selector matches this element?
    <div class="box" id="top">Hello</div>
    (a) .star (b) span (c) .box (d) #box
  27. 27.Which of these is margin? (a) a solid or dotted edge (b) the line round the box (c) space outside the border (d) the gap round content
  28. 28.🎨 What does CSS stand for? (a) Cascading Style Sheets (b) Computer Style Sheets (c) Colourful Site Styles (d) Creative Sheet System
  29. 29.🖌️ Which CSS property sets the letter colour? (a) background-color (b) font-weight (c) color (d) text-align
  30. 30.Which of these does HTML do? (a) lays out the page (b) changes the page live (c) puts a picture on a page (d) reacts to a button click
  31. 31.Which of these is margin? (a) the gap round content (b) space inside the border (c) the gap to other boxes (d) a solid or dotted edge
  32. 32.⚖️ What colour is the text of this element?
    <h1 class="red" id="top">Hi</h1>
    CSS:
    #top { color: yellow; }
    h1 { color: blue; }
    (a) red (b) yellow (c) blue (d) black
  33. 33.🎯 Which sign starts an id selector? (a) @ (b) & (c) # (d) .
  34. 34.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 220px;
      padding: 10px;
      border: 4px solid black;
      margin: 0px;
    }
  35. 35.🖌️ Where does the text sit on its line?
    h2 {
      font-size: 28px;
      text-align: left;
      color: red;
      background-color: orange;
    }
    (a) in the middle (b) on the left (c) on the right
  36. 36.✍️ Which property is set to 20px in this rule?
    .box {
      text-align: center;
      font-size: 20px;
    }
    (a) text-align (b) background-color (c) 20px (d) font-size
  37. 37.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 340px;
      justify-content: space-between;
    }
    Inside are 3 boxes, each 60px wide (no margins).
  38. 38.🌈 Which colour is rgb(0, 0, 255)? (a) white (b) red (c) magenta (d) blue
  39. 39.📦 In the box model, which part is the text or picture? (a) padding (b) margin (c) border (d) content
  40. 40.🌈 Which hex code is red? (a) #00ffff (b) #000000 (c) #ff0000 (d) #00ff00

Answer key

  1. 50
  2. :
  3. black
  4. 230
  5. .big
  6. green
  7. True
  8. red
  9. 296
  10. red
  11. 2
  12. True
  13. the later one
  14. red
  15. center
  16. an id selector
  17. 20
  18. False
  19. /*
  20. font-size
  21. <style>
  22. #top
  23. False
  24. False
  25. blue
  26. .box
  27. space outside the border
  28. Cascading Style Sheets
  29. color
  30. puts a picture on a page
  31. the gap to other boxes
  32. yellow
  33. #
  34. 248
  35. on the left
  36. font-size
  37. 80
  38. blue
  39. content
  40. #ff0000

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