← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 390 · 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: 80px;
      padding: 5px;
      border: 4px solid black;
      margin: 10px;
    }
  2. 2.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 140px;
      justify-content: space-between;
    }
    Inside are 2 boxes, each 40px wide (no margins).
  3. 3.📱 max-width: 600px applies when the screen is ___. (a) turned off (b) exactly 1000px (c) 600px or wider (d) 600px or narrower
  4. 4.⚖️ Which selector is the strongest? (a) a class selector (b) an id selector (c) an element selector
  5. 5.📦 In the box model, which part is space inside the border? (a) margin (b) padding (c) content (d) border
  6. 6.⚖️ What colour is the text of this element?
    <h2 class="red" id="logo">Hi</h2>
    CSS:
    #logo { color: red; }
    #logo { color: orange; }
    (a) orange (b) black (c) red (d) blue
  7. 7.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 170px;
      justify-content: flex-start;
    }
    Inside are 3 boxes, each 40px wide (no margins).
  8. 8.Which of these does CSS do? (a) makes headings and lists (b) makes a link (c) counts down a timer (d) changes the text size
  9. 9.🖌️ What colour are the letters?
    h2 {
      font-size: 20px;
      background-color: green;
      text-align: left;
      color: white;
    }
    (a) purple (b) green (c) white
  10. 10.🖌️ Which CSS property sets the letter colour? (a) font-family (b) background-color (c) font-size (d) color
  11. 11.⚖️ What colour is the text of this element?
    <h2 class="big" id="hero">Hi</h2>
    CSS:
    h2 { color: yellow; }
    #hero { color: green; }
    (a) white (b) yellow (c) green (d) purple
  12. 12.✍️ Which sign ends each CSS declaration? (a) ; (b) . (c) : (d) ,
  13. 13.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 260px;
      justify-content: center;
    }
    Inside are 4 boxes, each 60px wide (no margins).
  14. 14.🖌️ Which CSS property colours behind the text? (a) font-size (b) color (c) font-weight (d) background-color
  15. 15.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 210px;
      justify-content: flex-start;
    }
    Inside are 4 boxes, each 50px wide (no margins).
  16. 16.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 270px;
      justify-content: space-between;
    }
    Inside are 4 boxes, each 60px wide (no margins).
  17. 17.✍️ Which property is set to center in this rule?
    body {
      padding: 8px;
      text-align: center;
    }
    (a) background-color (b) center (c) margin (d) text-align
  18. 18.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 190px;
      padding: 25px;
      border: 3px solid black;
      margin: 10px;
    }
  19. 19.✍️ How does a CSS comment start? (a) # (b) // (c) /* (d) <!--
  20. 20.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 8px;
      }
    }
  21. 21.True or false: CSS adds space around boxes. (a) True (b) False
  22. 22.🖌️ Where does the text sit on its line?
    h2 {
      font-size: 40px;
      color: yellow;
      background-color: green;
      text-align: center;
    }
    (a) in the middle (b) on the left (c) on the right
  23. 23.✍️ What value is given to margin in this rule?
    body {
      border: 2px solid;
      margin: 10px;
    }
    (a) bold (b) 8px (c) 10px (d) margin
  24. 24.🖌️ Where does the text sit on its line?
    h2 {
      text-align: center;
      font-size: 28px;
      background-color: yellow;
      color: green;
    }
    (a) on the left (b) in the middle (c) on the right
  25. 25.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 260px;
      justify-content: space-between;
    }
    Inside are 2 boxes, each 100px wide (no margins).
  26. 26.🌈 Which hex code is cyan? (a) #0000ff (b) #00ffff (c) #00ff00 (d) #ffff00
  27. 27.📱 The screen is 414px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 8px;
      }
    }
    (a) No (b) Yes
  28. 28.🖌️ How big is the text, in px?
    li {
      color: blue;
      background-color: yellow;
      text-align: center;
      font-size: 40px;
    }
  29. 29.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 140px;
      padding: 15px;
      border: 4px solid black;
      margin: 20px;
    }
  30. 30.💪 Which justify-content value puts boxes in the middle? (a) center (b) flex-start (c) flex-end (d) space-between
  31. 31.Which of these is margin? (a) the gap round content (b) the gap to other boxes (c) space inside the border (d) the text or picture
  32. 32.🔍 Which is the odd one out? (a) checks a quiz answer (b) reacts to a button click (c) puts a picture on a page (d) changes the page live
  33. 33.✍️ In color: blue; which part is the property? (a) ; (b) blue (c) color (d) :
  34. 34.💪 Which justify-content value packs boxes at the end? (a) center (b) space-between (c) flex-start (d) flex-end
  35. 35.🧩 Which language lays out the page? (a) HTML (b) JavaScript (c) CSS
  36. 36.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 40px;
      padding: 10px;
      border: 2px solid black;
      margin: 10px;
    }
  37. 37.🌈 Which hex code is red? (a) #00ff00 (b) #ff0000 (c) #0000ff (d) #ffffff
  38. 38.🌈 In #000b00 the green part is the hex number 0b. What is it as a normal number?
  39. 39.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 120px;
      justify-content: space-between;
    }
    Inside are 2 boxes, each 40px wide (no margins).
  40. 40.True or false: CSS counts down a timer. (a) False (b) True

Answer key

  1. 118
  2. 60
  3. 600px or narrower
  4. an id selector
  5. padding
  6. orange
  7. 50
  8. changes the text size
  9. white
  10. color
  11. green
  12. ;
  13. 10
  14. background-color
  15. 10
  16. 10
  17. text-align
  18. 266
  19. /*
  20. 12
  21. True
  22. in the middle
  23. 10px
  24. in the middle
  25. 60
  26. #00ffff
  27. Yes
  28. 40
  29. 178
  30. center
  31. the gap to other boxes
  32. puts a picture on a page
  33. color
  34. flex-end
  35. CSS
  36. 84
  37. #ff0000
  38. 11
  39. 40
  40. False

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