← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 747 · 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.📦 In the box model, which part is space outside the border? (a) border (b) padding (c) margin (d) content
  2. 2.⚖️ What colour is the text of this element?
    <h2 class="red" id="end">Hi</h2>
    CSS:
    #end { color: white; }
    #end { color: red; }
    (a) orange (b) white (c) red (d) green
  3. 3.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 420px;
      justify-content: space-between;
    }
    Inside are 4 boxes, each 60px wide (no margins).
  4. 4.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 26px;
      }
    }
    (a) No (b) Yes
  5. 5.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 14px;
      }
    }
    (a) Yes (b) No
  6. 6.🌈 Which colour of light is strongest in rgb(23, 185, 70)? (a) blue (b) green (c) red
  7. 7.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 130px;
      justify-content: flex-end;
    }
    Inside are 2 boxes, each 60px wide (no margins).
  8. 8.🔍 Which is the odd one out? (a) makes a link (b) puts a picture on a page (c) makes headings and lists (d) sets colours and fonts
  9. 9.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 100px;
      padding: 15px;
      border: 4px solid black;
      margin: 0px;
    }
  10. 10.📦 In the box model, which part is space inside the border? (a) border (b) padding (c) margin (d) content
  11. 11.What does text-align do? (a) sets the letter colour (b) makes the text bold (c) centres a heading (d) makes letters bigger
  12. 12.🎨 One CSS file can style how many pages? (a) only one image (b) many pages (c) no pages (d) only one word
  13. 13.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 10px;
      }
    }
  14. 14.🖌️ Which CSS property picks the font style? (a) font-weight (b) text-align (c) color (d) font-family
  15. 15.🎯 What kind of selector is li? (a) an id selector (b) an element selector (c) a class selector
  16. 16.🧩 Which language changes the page live? (a) CSS (b) HTML (c) JavaScript
  17. 17.🖌️ How big is the text, in px?
    p {
      background-color: blue;
      color: white;
      text-align: left;
      font-size: 12px;
    }
  18. 18.Which of these does CSS do? (a) checks a quiz answer (b) counts down a timer (c) lays out the page (d) gives the page structure
  19. 19.✍️ How many declarations (property: value pairs) are in this rule?
    li {
      text-align: center;
      color: red;
    }
  20. 20.Which of these is the content? (a) a solid or dotted edge (b) the text or picture (c) space inside the border (d) the gap round content
  21. 21.⚖️ Which selector is the weakest? (a) a class selector (b) an id selector (c) an element selector
  22. 22.🖌️ Which CSS property makes letters bigger? (a) background-color (b) color (c) font-family (d) font-size
  23. 23.🌈 In #f40000 the red part is the hex number f4. What is it as a normal number?
  24. 24.💪 Which justify-content value equal gaps, none at ends? (a) center (b) flex-start (c) flex-end (d) space-between
  25. 25.🖌️ What colour is behind the letters?
    li {
      font-size: 36px;
      background-color: orange;
      color: blue;
      text-align: right;
    }
    (a) orange (b) blue (c) red
  26. 26.🎯 Which element does the selector .note style? (a) <h1 id="note"> (b) <h1 class="note"> (c) <h1 class="big"> (d) <h2 class="red">
  27. 27.🎯 Can many elements share the same class? (a) No (b) Yes
  28. 28.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 350px;
      justify-content: space-between;
    }
    Inside are 4 boxes, each 80px wide (no margins).
  29. 29.✍️ How many declarations (property: value pairs) are in this rule?
    body {
      border: 2px solid;
      padding: 8px;
      color: red;
    }
  30. 30.💪 Which flexbox property picks row or column? (a) justify-content (b) gap (c) flex-direction (d) display: flex
  31. 31.💪 Which justify-content value packs boxes at the start? (a) flex-end (b) center (c) space-between (d) flex-start
  32. 32.🔍 Which is the odd one out? (a) counts down a timer (b) rounds box corners (c) sets colours and fonts (d) lays out the page
  33. 33.🎯 Which element does the selector h2 style? (a) <li> (b) <span id="logo"> (c) <div class="big"> (d) <h2 class="big">
  34. 34.💪 Which justify-content value packs boxes at the end? (a) flex-start (b) space-between (c) flex-end (d) center
  35. 35.⚖️ What colour is the text of this element?
    <p class="big" id="logo">Hi</p>
    CSS:
    #logo { color: yellow; }
    .big { color: blue; }
    (a) orange (b) blue (c) yellow (d) green
  36. 36.✍️ Which property is set to bold in this rule?
    li {
      font-weight: bold;
      color: red;
    }
    (a) bold (b) width (c) border (d) font-weight
  37. 37.✍️ How does a CSS comment start? (a) /* (b) <!-- (c) // (d) #
  38. 38.📱 The screen is 700px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 14px;
      }
    }
    (a) Yes (b) No
  39. 39.What does color do? (a) colours behind the text (b) centres a heading (c) sets the letter colour (d) picks the font style
  40. 40.Which of these is margin? (a) a solid or dotted edge (b) the text or picture (c) the gap to other boxes (d) the gap round content

Answer key

  1. margin
  2. red
  3. 60
  4. No
  5. Yes
  6. green
  7. 10
  8. sets colours and fonts
  9. 138
  10. padding
  11. centres a heading
  12. many pages
  13. 10
  14. font-family
  15. an element selector
  16. JavaScript
  17. 12
  18. lays out the page
  19. 2
  20. the text or picture
  21. an element selector
  22. font-size
  23. 244
  24. space-between
  25. orange
  26. <h1 class="note">
  27. Yes
  28. 10
  29. 3
  30. flex-direction
  31. flex-start
  32. counts down a timer
  33. <h2 class="big">
  34. flex-end
  35. yellow
  36. font-weight
  37. /*
  38. Yes
  39. sets the letter colour
  40. the gap to other boxes

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