← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 256 · 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 justify-content value puts boxes in the middle? (a) flex-start (b) space-between (c) center (d) flex-end
  2. 2.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 190px;
      justify-content: flex-start;
    }
    Inside are 3 boxes, each 60px wide (no margins).
  3. 3.🌈 Which colour is #ff0000? (a) white (b) red (c) yellow (d) cyan
  4. 4.🖌️ Which CSS property sets the letter colour? (a) font-family (b) text-align (c) color (d) font-weight
  5. 5.🎨 A CSS file usually ends with which extension? (a) .html (b) .js (c) .css (d) .png
  6. 6.🌈 Which colour is #ff00ff? (a) black (b) yellow (c) magenta (d) blue
  7. 7.🖌️ What colour are the letters?
    h1 {
      font-size: 12px;
      text-align: left;
      color: red;
      background-color: blue;
    }
    (a) red (b) blue (c) purple
  8. 8.🌈 In #00009f the blue part is the hex number 9f. What is it as a normal number?
  9. 9.🌈 In #ef0000 the red part is the hex number ef. What is it as a normal number?
  10. 10.🎯 Which CSS selector matches this element?
    <span class="big" id="end">Hello</span>
    (a) #big (b) #hero (c) .big (d) .red
  11. 11.Which of these is margin? (a) the text or picture (b) space inside the border (c) space outside the border (d) the gap round content
  12. 12.✍️ CSS declarations go inside which brackets? (a) [ ] (b) { } (c) ( ) (d) < >
  13. 13.⚖️ What colour is the text of this element?
    <p class="note" id="top">Hi</p>
    CSS:
    #top { color: black; }
    p { color: yellow; }
    .note { color: white; }
    (a) white (b) purple (c) yellow (d) black
  14. 14.💪 Which justify-content value equal gaps, none at ends? (a) space-between (b) flex-end (c) center (d) flex-start
  15. 15.Which of these does HTML do? (a) changes the page live (b) reacts to a button click (c) lays out the page (d) makes headings and lists
  16. 16.🖌️ What colour is behind the letters?
    p {
      background-color: white;
      text-align: left;
      color: blue;
      font-size: 16px;
    }
    (a) blue (b) red (c) white
  17. 17.🎯 Which CSS selector matches this element?
    <span class="star" id="intro">Hello</span>
    (a) .menu (b) .intro (c) #intro (d) #star
  18. 18.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 28px;
      }
    }
  19. 19.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 180px;
      justify-content: space-between;
    }
    Inside are 2 boxes, each 60px wide (no margins).
  20. 20.⚖️ What colour is the text of this element?
    <p class="red" id="end">Hi</p>
    CSS:
    #end { color: purple; }
    .red { color: red; }
    (a) red (b) orange (c) purple (d) black
  21. 21.⚖️ Which selector is the weakest? (a) an id selector (b) an element selector (c) a class selector
  22. 22.What does justify-content: flex-end 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
  23. 23.✍️ Which property is set to yellow in this rule?
    .box {
      margin: 10px;
      background-color: yellow;
      font-weight: bold;
      font-size: 20px;
    }
    (a) padding (b) background-color (c) yellow (d) margin
  24. 24.Which of these does CSS do? (a) makes a link (b) reacts to a button click (c) makes headings and lists (d) lays out the page
  25. 25.True or false: margin is the gap to other boxes. (a) False (b) True
  26. 26.🖌️ What colour are the letters?
    p {
      color: yellow;
      font-size: 32px;
      text-align: center;
      background-color: orange;
    }
    (a) yellow (b) black (c) orange
  27. 27.🎯 Which element does the selector h2 style? (a) <h2 class="menu"> (b) <li> (c) <div class="menu"> (d) <span id="logo">
  28. 28.True or false: JavaScript reacts to a button click. (a) False (b) True
  29. 29.🌈 In #00d100 the green part is the hex number d1. What is it as a normal number?
  30. 30.✍️ What is the selector in this CSS rule?
    .box {
      font-size: 20px;
      padding: 8px;
      width: 300px;
      font-style: italic;
    }
    (a) font-size (b) 8px (c) .box (d) h2
  31. 31.True or false: padding is space inside the border. (a) True (b) False
  32. 32.🎯 Which element does the selector #top style? (a) <li class="top"> (b) <div class="big"> (c) <li id="intro"> (d) <li id="top">
  33. 33.⚖️ What colour is the text of this element?
    <h1 class="note" id="logo">Hi</h1>
    CSS:
    h1 { color: orange; }
    .note { color: blue; }
    #logo { color: purple; }
    (a) orange (b) purple (c) white (d) blue
  34. 34.Which of these does JavaScript do? (a) gives the page structure (b) makes headings and lists (c) lays out the page (d) checks a quiz answer
  35. 35.🎯 What kind of selector is img? (a) an element selector (b) an id selector (c) a class selector
  36. 36.✍️ Which property is set to 10px in this rule?
    .note {
      margin: 10px;
      padding: 8px;
      background-color: yellow;
      width: 300px;
    }
    (a) margin (b) font-weight (c) padding (d) 10px
  37. 37.🧩 Which language lays out the page? (a) CSS (b) JavaScript (c) HTML
  38. 38.🎯 Which sign starts an id selector? (a) . (b) @ (c) & (d) #
  39. 39.⚖️ What colour is the text of this element?
    <h1 class="star" id="intro">Hi</h1>
    CSS:
    h1 { color: blue; }
    h1 { color: white; }
    (a) blue (b) red (c) black (d) white
  40. 40.🧩 Which language checks a quiz answer? (a) JavaScript (b) HTML (c) CSS

Answer key

  1. center
  2. 10
  3. red
  4. color
  5. .css
  6. magenta
  7. red
  8. 159
  9. 239
  10. .big
  11. space outside the border
  12. { }
  13. black
  14. space-between
  15. makes headings and lists
  16. white
  17. #intro
  18. 20
  19. 60
  20. purple
  21. an element selector
  22. packs boxes at the end
  23. background-color
  24. lays out the page
  25. True
  26. yellow
  27. <h2 class="menu">
  28. True
  29. 209
  30. .box
  31. True
  32. <li id="top">
  33. purple
  34. checks a quiz answer
  35. an element selector
  36. margin
  37. CSS
  38. #
  39. white
  40. JavaScript

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