← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 347 · 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.🎯 Which sign starts an id selector? (a) # (b) . (c) @ (d) &
  2. 2.💪 Which flexbox property turns on flexbox? (a) justify-content (b) flex-direction (c) display: flex (d) align-items
  3. 3.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 80px;
      padding: 10px;
      border: 1px solid black;
      margin: 5px;
    }
  4. 4.🖌️ What colour is behind the letters?
    h1 {
      text-align: left;
      color: black;
      background-color: red;
      font-size: 12px;
    }
    (a) blue (b) red (c) black
  5. 5.💪 Which flexbox property spaces boxes along a row? (a) gap (b) display: flex (c) align-items (d) justify-content
  6. 6.🎯 Which sign starts a class selector? (a) . (b) @ (c) & (d) #
  7. 7.📱 Responsive design means a page ___. (a) has no pictures (b) fits every screen (c) is only for laptops (d) never changes
  8. 8.💪 Which justify-content value equal gaps, none at ends? (a) flex-start (b) center (c) space-between (d) flex-end
  9. 9.Which of these does HTML do? (a) puts a picture on a page (b) lays out the page (c) changes the page live (d) shows a pop-up message
  10. 10.🌈 Which colour is #00ffff? (a) black (b) cyan (c) bright green (d) yellow
  11. 11.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 100px;
      padding: 25px;
      border: 2px solid black;
      margin: 20px;
    }
  12. 12.What does background-color do? (a) sets the letter colour (b) picks the font style (c) makes letters bigger (d) colours behind the text
  13. 13.What does font-family do? (a) sets the letter colour (b) colours behind the text (c) picks the font style (d) makes the text bold
  14. 14.🌈 Which colour is rgb(0, 0, 255)? (a) blue (b) white (c) black (d) bright green
  15. 15.✍️ What is the selector in this CSS rule?
    .box {
      color: red;
      text-align: center;
      font-style: italic;
      background-color: yellow;
    }
    (a) color (b) center (c) .box (d) h2
  16. 16.⚖️ What colour is the text of this element?
    <h1 class="note" id="hero">Hi</h1>
    CSS:
    h1 { color: white; }
    #hero { color: blue; }
    .note { color: orange; }
    (a) orange (b) red (c) blue (d) white
  17. 17.✍️ What value is given to margin in this rule?
    .note {
      margin: 10px;
      border: 2px solid;
    }
    (a) bold (b) 10px (c) 8px (d) margin
  18. 18.✍️ How many declarations (property: value pairs) are in this rule?
    h1 {
      width: 300px;
      color: red;
    }
  19. 19.✍️ How many declarations (property: value pairs) are in this rule?
    h1 {
      border: 2px solid;
      color: red;
    }
  20. 20.✍️ How many declarations (property: value pairs) are in this rule?
    li {
      text-align: center;
      margin: 10px;
    }
  21. 21.✍️ Which sign goes between a property and its value? (a) ; (b) : (c) - (d) =
  22. 22.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 120px;
      padding: 10px;
      border: 1px solid black;
      margin: 5px;
    }
  23. 23.🧩 Which language rounds box corners? (a) HTML (b) CSS (c) JavaScript
  24. 24.✍️ Which sign ends each CSS declaration? (a) , (b) : (c) . (d) ;
  25. 25.✍️ How many declarations (property: value pairs) are in this rule?
    li {
      margin: 10px;
      padding: 8px;
    }
  26. 26.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 320px;
      justify-content: space-between;
    }
    Inside are 3 boxes, each 60px wide (no margins).
  27. 27.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 280px;
      justify-content: flex-end;
    }
    Inside are 3 boxes, each 80px wide (no margins).
  28. 28.Which of these is padding? (a) a solid or dotted edge (b) space inside the border (c) the line round the box (d) the text or picture
  29. 29.✍️ How many declarations (property: value pairs) are in this rule?
    p {
      background-color: yellow;
      font-weight: bold;
      margin: 10px;
    }
  30. 30.🖌️ What colour are the letters?
    h1 {
      color: red;
      font-size: 24px;
      background-color: black;
      text-align: center;
    }
    (a) red (b) white (c) black
  31. 31.🌈 Hex digits go 0 to 9, then A to which letter? (a) Z (b) J (c) G (d) F
  32. 32.⚖️ What colour is the text of this element?
    <h1 class="box" id="hero">Hi</h1>
    CSS:
    h1 { color: orange; }
    h1 { color: blue; }
    (a) orange (b) purple (c) blue (d) red
  33. 33.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 22px;
      }
    }
  34. 34.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 280px;
      justify-content: flex-start;
    }
    Inside are 4 boxes, each 50px wide (no margins).
  35. 35.🔍 Which is the odd one out? (a) adds space around boxes (b) rounds box corners (c) sets colours and fonts (d) checks a quiz answer
  36. 36.💪 Which justify-content value packs boxes at the start? (a) space-between (b) flex-start (c) flex-end (d) center
  37. 37.What does justify-content: flex-start do? (a) equal gaps, none at ends (b) puts boxes in the middle (c) packs boxes at the end (d) packs boxes at the start
  38. 38.🧩 Which language adds space around boxes? (a) CSS (b) HTML (c) JavaScript
  39. 39.🎨 Which attribute adds CSS inside one tag? (a) style (b) src (c) alt (d) href
  40. 40.⚖️ Which selector is the strongest? (a) a class selector (b) an id selector (c) an element selector

Answer key

  1. #
  2. display: flex
  3. 112
  4. red
  5. justify-content
  6. .
  7. fits every screen
  8. space-between
  9. puts a picture on a page
  10. cyan
  11. 194
  12. colours behind the text
  13. picks the font style
  14. blue
  15. .box
  16. blue
  17. 10px
  18. 2
  19. 2
  20. 2
  21. :
  22. 142
  23. CSS
  24. ;
  25. 2
  26. 70
  27. 40
  28. space inside the border
  29. 3
  30. red
  31. F
  32. blue
  33. 22
  34. 80
  35. checks a quiz answer
  36. flex-start
  37. packs boxes at the start
  38. CSS
  39. style
  40. an id selector

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