← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 85 · 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.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 20px;
      }
    }
  2. 2.Which of these is margin? (a) space inside the border (b) the text or picture (c) the gap to other boxes (d) a solid or dotted edge
  3. 3.⚖️ What colour is the text of this element?
    <h2 class="note" id="end">Hi</h2>
    CSS:
    .note { color: orange; }
    .note { color: green; }
    (a) red (b) green (c) orange (d) black
  4. 4.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 140px;
      padding: 10px;
      border: 3px solid black;
      margin: 15px;
    }
  5. 5.True or false: CSS sets colours and fonts. (a) False (b) True
  6. 6.🎨 Which tag holds CSS inside the head? (a) <script> (b) <body> (c) <style> (d) <css>
  7. 7.✍️ Which property is set to 300px in this rule?
    h1 {
      background-color: yellow;
      width: 300px;
    }
    (a) color (b) width (c) 300px (d) font-style
  8. 8.⚖️ What colour is the text of this element?
    <p class="star" id="logo">Hi</p>
    CSS:
    p { color: blue; }
    .star { color: white; }
    (a) purple (b) blue (c) red (d) white
  9. 9.⚖️ Which selector is the weakest? (a) an id selector (b) an element selector (c) a class selector
  10. 10.🖌️ What colour are the letters?
    li {
      color: purple;
      font-size: 32px;
      text-align: center;
      background-color: yellow;
    }
    (a) purple (b) yellow (c) white
  11. 11.🖌️ What colour is behind the letters?
    h1 {
      text-align: left;
      background-color: green;
      font-size: 32px;
      color: red;
    }
    (a) white (b) green (c) red
  12. 12.✍️ How does a CSS comment start? (a) # (b) <!-- (c) // (d) /*
  13. 13.✍️ Which property is set to 20px in this rule?
    .box {
      font-size: 20px;
      text-align: center;
    }
    (a) font-size (b) background-color (c) text-align (d) 20px
  14. 14.📱 The screen is 820px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 16px;
      }
    }
    (a) Yes (b) No
  15. 15.🖌️ How big is the text, in px?
    p {
      text-align: center;
      color: green;
      background-color: yellow;
      font-size: 20px;
    }
  16. 16.⚖️ What colour is the text of this element?
    <h1 class="big" id="top">Hi</h1>
    CSS:
    #top { color: blue; }
    .big { color: green; }
    h1 { color: white; }
    (a) blue (b) green (c) white (d) purple
  17. 17.🌈 Which colour is #00ffff? (a) cyan (b) yellow (c) blue (d) red
  18. 18.🎯 Which element does the selector div style? (a) <div class="big"> (b) <h1 id="logo"> (c) <span> (d) <p class="big">
  19. 19.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 18px;
      }
    }
  20. 20.🎯 Which sign starts a class selector? (a) . (b) & (c) # (d) @
  21. 21.Which of these is padding? (a) the gap to other boxes (b) the line round the box (c) the gap round content (d) space outside the border
  22. 22.🎨 A CSS file usually ends with which extension? (a) .js (b) .png (c) .html (d) .css
  23. 23.⚖️ What colour is the text of this element?
    <p class="box" id="top">Hi</p>
    CSS:
    p { color: white; }
    p { color: orange; }
    (a) green (b) white (c) purple (d) orange
  24. 24.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 250px;
      padding: 10px;
      border: 4px solid black;
      margin: 5px;
    }
  25. 25.🖌️ How big is the text, in px?
    li {
      text-align: right;
      background-color: yellow;
      font-size: 20px;
      color: orange;
    }
  26. 26.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 18px;
      }
    }
  27. 27.🖌️ Which CSS property colours behind the text? (a) font-size (b) font-family (c) background-color (d) color
  28. 28.📱 The screen is 414px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 20px;
      }
    }
    (a) No (b) Yes
  29. 29.⚖️ What colour is the text of this element?
    <p class="big" id="main">Hi</p>
    CSS:
    .big { color: purple; }
    #main { color: yellow; }
    p { color: white; }
    (a) blue (b) white (c) purple (d) yellow
  30. 30.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 250px;
      justify-content: flex-start;
    }
    Inside are 4 boxes, each 50px wide (no margins).
  31. 31.💪 Which justify-content value packs boxes at the start? (a) flex-start (b) flex-end (c) center (d) space-between
  32. 32.📱 max-width: 600px applies when the screen is ___. (a) turned off (b) 600px or narrower (c) exactly 1000px (d) 600px or wider
  33. 33.What does text-align do? (a) colours behind the text (b) makes letters bigger (c) centres a heading (d) picks the font style
  34. 34.✍️ How many declarations (property: value pairs) are in this rule?
    .box {
      color: red;
      padding: 8px;
    }
  35. 35.✍️ Which property is set to red in this rule?
    #top {
      color: red;
      font-weight: bold;
      width: 300px;
      font-size: 20px;
    }
    (a) font-size (b) color (c) text-align (d) red
  36. 36.🎯 What kind of selector is .note? (a) an element selector (b) a class selector (c) an id selector
  37. 37.⚖️ What colour is the text of this element?
    <p class="menu" id="end">Hi</p>
    CSS:
    .menu { color: green; }
    p { color: yellow; }
    (a) yellow (b) orange (c) green (d) red
  38. 38.🌈 In #b90000 the red part is the hex number b9. What is it as a normal number?
  39. 39.Which of these does CSS do? (a) changes the page live (b) changes the text size (c) shows a pop-up message (d) makes a form box
  40. 40.✍️ Which property is set to 300px in this rule?
    p {
      font-size: 20px;
      padding: 8px;
      width: 300px;
    }
    (a) 300px (b) color (c) font-style (d) width

Answer key

  1. 24
  2. the gap to other boxes
  3. green
  4. 196
  5. True
  6. <style>
  7. width
  8. white
  9. an element selector
  10. purple
  11. green
  12. /*
  13. font-size
  14. No
  15. 20
  16. blue
  17. cyan
  18. <div class="big">
  19. 24
  20. .
  21. the gap round content
  22. .css
  23. orange
  24. 278
  25. 20
  26. 18
  27. background-color
  28. Yes
  29. yellow
  30. 50
  31. flex-start
  32. 600px or narrower
  33. centres a heading
  34. 2
  35. color
  36. a class selector
  37. green
  38. 185
  39. changes the text size
  40. width

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