← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 713 · 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 flexbox property turns on flexbox? (a) justify-content (b) display: flex (c) gap (d) flex-direction
  2. 2.💪 Which justify-content value packs boxes at the start? (a) flex-end (b) space-between (c) center (d) flex-start
  3. 3.🎯 What kind of selector is p? (a) a class selector (b) an element selector (c) an id selector
  4. 4.What does justify-content: space-between do? (a) equal gaps, none at ends (b) packs boxes at the start (c) puts boxes in the middle (d) packs boxes at the end
  5. 5.🎯 Can many elements share the same class? (a) No (b) Yes
  6. 6.Which of these does JavaScript do? (a) changes the page live (b) makes a form box (c) gives the page structure (d) makes headings and lists
  7. 7.🖌️ Which CSS property makes the text bold? (a) text-align (b) color (c) font-weight (d) font-family
  8. 8.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 180px;
      justify-content: space-between;
    }
    Inside are 3 boxes, each 40px wide (no margins).
  9. 9.What does font-size do? (a) makes letters bigger (b) sets the letter colour (c) picks the font style (d) colours behind the text
  10. 10.🧩 Which language changes the text size? (a) JavaScript (b) HTML (c) CSS
  11. 11.🖌️ What colour is behind the letters?
    h2 {
      background-color: white;
      text-align: right;
      color: red;
      font-size: 40px;
    }
    (a) purple (b) red (c) white
  12. 12.⚖️ What colour is the text of this element?
    <h2 class="note" id="top">Hi</h2>
    CSS:
    #top { color: white; }
    .note { color: yellow; }
    (a) red (b) yellow (c) orange (d) white
  13. 13.📱 Which tag helps phones show a page at the right size? (a) the hr tag (b) the title tag (c) the viewport meta tag (d) the br tag
  14. 14.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 18px;
      }
    }
  15. 15.🌈 In #rrggbb, which colour do the first two digits give? (a) black (b) blue (c) red (d) green
  16. 16.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 18px;
      }
    }
  17. 17.📱 Responsive design means a page ___. (a) is only for laptops (b) never changes (c) has no pictures (d) fits every screen
  18. 18.Which of these does HTML do? (a) makes a link (b) changes the text size (c) sets colours and fonts (d) lays out the page
  19. 19.🎯 Which CSS selector matches this element?
    <div class="note" id="intro">Hello</div>
    (a) .big (b) #note (c) .note (d) .intro
  20. 20.✍️ How many declarations (property: value pairs) are in this rule?
    body {
      width: 300px;
      font-weight: bold;
      padding: 8px;
      border: 2px solid;
    }
  21. 21.🌈 Which colour is rgb(255, 0, 255)? (a) red (b) yellow (c) bright green (d) magenta
  22. 22.📦 In the box model, which part is space inside the border? (a) content (b) margin (c) border (d) padding
  23. 23.🌈 Which colour is #ffffff? (a) blue (b) white (c) red (d) black
  24. 24.✍️ Which property is set to bold in this rule?
    h1 {
      width: 300px;
      font-weight: bold;
    }
    (a) border (b) width (c) font-weight (d) bold
  25. 25.🖌️ What colour is behind the letters?
    h2 {
      background-color: red;
      text-align: right;
      font-size: 32px;
      color: green;
    }
    (a) red (b) black (c) green
  26. 26.✍️ Which property is set to center in this rule?
    h2 {
      text-align: center;
      font-style: italic;
      padding: 8px;
    }
    (a) margin (b) center (c) text-align (d) background-color
  27. 27.True or false: #logo is a class selector. (a) False (b) True
  28. 28.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 8px;
      }
    }
  29. 29.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 100px;
      padding: 5px;
      border: 1px solid black;
      margin: 0px;
    }
  30. 30.🖌️ What colour are the letters?
    li {
      background-color: red;
      font-size: 24px;
      color: blue;
      text-align: right;
    }
    (a) black (b) blue (c) red
  31. 31.🌈 Hex digits go 0 to 9, then A to which letter? (a) Z (b) G (c) J (d) F
  32. 32.🎯 What kind of selector is .big? (a) an element selector (b) a class selector (c) an id selector
  33. 33.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 220px;
      justify-content: space-between;
    }
    Inside are 3 boxes, each 40px wide (no margins).
  34. 34.🖌️ Where does the text sit on its line?
    h1 {
      background-color: orange;
      color: yellow;
      font-size: 12px;
      text-align: center;
    }
    (a) on the right (b) in the middle (c) on the left
  35. 35.📦 In the box model, which part is the gap round content? (a) margin (b) padding (c) content (d) border
  36. 36.🎯 What kind of selector is .note? (a) an id selector (b) an element selector (c) a class selector
  37. 37.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 120px;
      justify-content: center;
    }
    Inside are 2 boxes, each 40px wide (no margins).
  38. 38.⚖️ Which selector is the strongest? (a) a class selector (b) an element selector (c) an id selector
  39. 39.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 190px;
      padding: 15px;
      border: 4px solid black;
      margin: 20px;
    }
  40. 40.🌈 Which colour of light is strongest in rgb(105, 193, 26)? (a) green (b) red (c) blue

Answer key

  1. display: flex
  2. flex-start
  3. an element selector
  4. equal gaps, none at ends
  5. Yes
  6. changes the page live
  7. font-weight
  8. 30
  9. makes letters bigger
  10. CSS
  11. white
  12. white
  13. the viewport meta tag
  14. 20
  15. red
  16. 16
  17. fits every screen
  18. makes a link
  19. .note
  20. 4
  21. magenta
  22. padding
  23. white
  24. font-weight
  25. red
  26. text-align
  27. False
  28. 12
  29. 112
  30. blue
  31. F
  32. a class selector
  33. 50
  34. in the middle
  35. padding
  36. a class selector
  37. 20
  38. an id selector
  39. 268
  40. green

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