← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 281 · 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.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the shorter one (b) the later one (c) the first one (d) neither
  2. 2.💪 Which justify-content value packs boxes at the start? (a) center (b) space-between (c) flex-end (d) flex-start
  3. 3.⚖️ What colour is the text of this element?
    <p class="note" id="top">Hi</p>
    CSS:
    p { color: black; }
    #top { color: orange; }
    .note { color: yellow; }
    (a) yellow (b) orange (c) purple (d) black
  4. 4.True or false: padding is the gap round content. (a) False (b) True
  5. 5.🎯 Which element does the selector .note style? (a) <p class="big"> (b) <h1 class="red"> (c) <p class="note"> (d) <p id="note">
  6. 6.🌈 Which colour is rgb(0, 255, 255)? (a) magenta (b) bright green (c) yellow (d) cyan
  7. 7.True or false: HTML makes a form box. (a) False (b) True
  8. 8.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 32px;
      }
    }
    (a) Yes (b) No
  9. 9.🎯 What kind of selector is .card? (a) an id selector (b) an element selector (c) a class selector
  10. 10.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 200px;
      justify-content: flex-end;
    }
    Inside are 4 boxes, each 40px wide (no margins).
  11. 11.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 220px;
      padding: 25px;
      border: 5px solid black;
      margin: 5px;
    }
  12. 12.⚖️ Which selector is the weakest? (a) an element selector (b) a class selector (c) an id selector
  13. 13.🌈 Which colour of light is strongest in rgb(75, 17, 225)? (a) blue (b) green (c) red
  14. 14.🖌️ How big is the text, in px?
    li {
      text-align: left;
      background-color: green;
      font-size: 36px;
      color: blue;
    }
  15. 15.⚖️ What colour is the text of this element?
    <h1 class="red" id="top">Hi</h1>
    CSS:
    .red { color: orange; }
    .red { color: blue; }
    (a) orange (b) white (c) blue (d) yellow
  16. 16.🎯 Which element does the selector .menu style? (a) <p class="menu"> (b) <p class="note"> (c) <p id="menu"> (d) <h1 class="big">
  17. 17.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 440px;
      justify-content: flex-start;
    }
    Inside are 4 boxes, each 100px wide (no margins).
  18. 18.What does color do? (a) makes the text bold (b) makes letters bigger (c) centres a heading (d) sets the letter colour
  19. 19.🧩 Which language makes headings and lists? (a) JavaScript (b) HTML (c) CSS
  20. 20.✍️ How many declarations (property: value pairs) are in this rule?
    h1 {
      margin: 10px;
    }
  21. 21.What does text-align do? (a) colours behind the text (b) makes the text bold (c) sets the letter colour (d) centres a heading
  22. 22.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 22px;
      }
    }
  23. 23.✍️ What is the selector in this CSS rule?
    .note {
      padding: 8px;
      background-color: yellow;
      text-align: center;
      color: red;
    }
    (a) .note (b) yellow (c) padding (d) #top
  24. 24.✍️ Which property is set to 2px solid in this rule?
    h2 {
      padding: 8px;
      border: 2px solid;
    }
    (a) font-style (b) border (c) width (d) 2px solid
  25. 25.⚖️ What colour is the text of this element?
    <h1 class="star" id="end">Hi</h1>
    CSS:
    .star { color: red; }
    #end { color: blue; }
    (a) blue (b) red (c) black (d) purple
  26. 26.Which of these does CSS do? (a) puts a picture on a page (b) rounds box corners (c) makes headings and lists (d) checks a quiz answer
  27. 27.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 220px;
      justify-content: flex-start;
    }
    Inside are 4 boxes, each 40px wide (no margins).
  28. 28.⚖️ What colour is the text of this element?
    <h1 class="note" id="intro">Hi</h1>
    CSS:
    h1 { color: green; }
    h1 { color: red; }
    (a) orange (b) red (c) green (d) blue
  29. 29.📱 What does a media query check? (a) the time of day (b) the screen width (c) the page title (d) the battery level
  30. 30.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 220px;
      justify-content: flex-end;
    }
    Inside are 2 boxes, each 80px wide (no margins).
  31. 31.⚖️ Which selector is the strongest? (a) a class selector (b) an id selector (c) an element selector
  32. 32.✍️ How many declarations (property: value pairs) are in this rule?
    body {
      text-align: center;
      margin: 10px;
      background-color: yellow;
      font-size: 20px;
    }
  33. 33.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 12px;
      }
    }
    (a) Yes (b) No
  34. 34.True or false: .menu is a class selector. (a) True (b) False
  35. 35.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 200px;
      justify-content: center;
    }
    Inside are 2 boxes, each 50px wide (no margins).
  36. 36.True or false: CSS changes the text size. (a) False (b) True
  37. 37.True or false: .menu is an element selector. (a) False (b) True
  38. 38.🖌️ Which CSS property makes the text bold? (a) background-color (b) font-weight (c) color (d) text-align
  39. 39.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 50px;
      padding: 30px;
      border: 3px solid black;
      margin: 10px;
    }
  40. 40.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 520px;
      justify-content: space-between;
    }
    Inside are 4 boxes, each 100px wide (no margins).

Answer key

  1. the later one
  2. flex-start
  3. orange
  4. True
  5. <p class="note">
  6. cyan
  7. True
  8. No
  9. a class selector
  10. 40
  11. 290
  12. an element selector
  13. blue
  14. 36
  15. blue
  16. <p class="menu">
  17. 40
  18. sets the letter colour
  19. HTML
  20. 1
  21. centres a heading
  22. 22
  23. .note
  24. border
  25. blue
  26. rounds box corners
  27. 60
  28. red
  29. the screen width
  30. 60
  31. an id selector
  32. 4
  33. Yes
  34. True
  35. 50
  36. True
  37. False
  38. font-weight
  39. 136
  40. 40

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