← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 63 · 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 tag holds CSS inside the head? (a) <script> (b) <body> (c) <style> (d) <css>
  2. 2.True or false: li is a class selector. (a) False (b) True
  3. 3.🎯 What kind of selector is p? (a) an element selector (b) a class selector (c) an id selector
  4. 4.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 210px;
      padding: 30px;
      border: 5px solid black;
      margin: 5px;
    }
  5. 5.✍️ Which property is set to yellow in this rule?
    p {
      background-color: yellow;
      font-size: 20px;
    }
    (a) yellow (b) background-color (c) margin (d) padding
  6. 6.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 28px;
      }
    }
  7. 7.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 6px;
      }
    }
  8. 8.Which of these is padding? (a) the text or picture (b) a solid or dotted edge (c) the gap to other boxes (d) space inside the border
  9. 9.🔍 Which is the odd one out? (a) reacts to a button click (b) makes headings and lists (c) changes the page live (d) checks a quiz answer
  10. 10.🖌️ How big is the text, in px?
    h1 {
      color: red;
      text-align: center;
      background-color: orange;
      font-size: 40px;
    }
  11. 11.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 240px;
      justify-content: center;
    }
    Inside are 2 boxes, each 50px wide (no margins).
  12. 12.True or false: margin is space outside the border. (a) False (b) True
  13. 13.📱 What does a media query check? (a) the page title (b) the time of day (c) the battery level (d) the screen width
  14. 14.🖌️ What colour are the letters?
    h2 {
      background-color: orange;
      text-align: center;
      color: purple;
      font-size: 12px;
    }
    (a) orange (b) purple (c) red
  15. 15.🔍 Which is the odd one out? (a) makes headings and lists (b) makes a form box (c) shows a pop-up message (d) gives the page structure
  16. 16.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 70px;
      padding: 5px;
      border: 5px solid black;
      margin: 20px;
    }
  17. 17.💪 Which justify-content value equal gaps, none at ends? (a) flex-end (b) center (c) space-between (d) flex-start
  18. 18.🖌️ What colour are the letters?
    h2 {
      color: blue;
      font-size: 36px;
      background-color: orange;
      text-align: right;
    }
    (a) red (b) orange (c) blue
  19. 19.🎯 Can many elements share the same class? (a) Yes (b) No
  20. 20.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 130px;
      justify-content: space-between;
    }
    Inside are 2 boxes, each 50px wide (no margins).
  21. 21.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 260px;
      justify-content: flex-end;
    }
    Inside are 3 boxes, each 80px wide (no margins).
  22. 22.📱 The screen is 700px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 24px;
      }
    }
    (a) No (b) Yes
  23. 23.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 190px;
      padding: 15px;
      border: 4px solid black;
      margin: 20px;
    }
  24. 24.🧩 Which language makes headings and lists? (a) JavaScript (b) HTML (c) CSS
  25. 25.🎯 Which sign starts an id selector? (a) . (b) # (c) & (d) @
  26. 26.🎯 Which sign starts a class selector? (a) & (b) . (c) @ (d) #
  27. 27.✍️ Which property is set to center in this rule?
    li {
      border: 2px solid;
      font-style: italic;
      text-align: center;
      background-color: yellow;
    }
    (a) margin (b) center (c) background-color (d) text-align
  28. 28.🎯 Which element does the selector #intro style? (a) <div id="intro"> (b) <div class="intro"> (c) <span class="menu"> (d) <div id="main">
  29. 29.What does font-size do? (a) makes the text bold (b) sets the letter colour (c) makes letters bigger (d) colours behind the text
  30. 30.Which of these is the content? (a) space outside the border (b) a solid or dotted edge (c) the text or picture (d) the gap to other boxes
  31. 31.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 230px;
      justify-content: center;
    }
    Inside are 3 boxes, each 50px wide (no margins).
  32. 32.Which of these is margin? (a) a solid or dotted edge (b) the gap round content (c) space outside the border (d) the text or picture
  33. 33.🎯 What kind of selector is #logo? (a) an id selector (b) an element selector (c) a class selector
  34. 34.💪 Which flexbox property spaces boxes along a row? (a) flex-direction (b) gap (c) justify-content (d) display: flex
  35. 35.What does justify-content: flex-start do? (a) puts boxes in the middle (b) packs boxes at the start (c) equal gaps, none at ends (d) packs boxes at the end
  36. 36.✍️ In color: blue; which part is the value? (a) : (b) color (c) blue (d) ;
  37. 37.What does justify-content: space-between do? (a) puts boxes in the middle (b) packs boxes at the end (c) packs boxes at the start (d) equal gaps, none at ends
  38. 38.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 10px;
      }
    }
  39. 39.True or false: HTML makes headings and lists. (a) True (b) False
  40. 40.🌈 Which hex code is blue? (a) #ffff00 (b) #000000 (c) #0000ff (d) #00ff00

Answer key

  1. <style>
  2. False
  3. an element selector
  4. 290
  5. background-color
  6. 28
  7. 12
  8. space inside the border
  9. makes headings and lists
  10. 40
  11. 70
  12. True
  13. the screen width
  14. purple
  15. shows a pop-up message
  16. 90
  17. space-between
  18. blue
  19. Yes
  20. 30
  21. 20
  22. No
  23. 228
  24. HTML
  25. #
  26. .
  27. text-align
  28. <div id="intro">
  29. makes letters bigger
  30. the text or picture
  31. 40
  32. space outside the border
  33. an id selector
  34. justify-content
  35. packs boxes at the start
  36. blue
  37. equal gaps, none at ends
  38. 10
  39. True
  40. #0000ff

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