← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 215 · 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.📱 What does a media query check? (a) the screen width (b) the time of day (c) the page title (d) the battery level
  2. 2.🎯 What kind of selector is #hero? (a) an id selector (b) a class selector (c) an element selector
  3. 3.⚖️ What colour is the text of this element?
    <h2 class="big" id="hero">Hi</h2>
    CSS:
    #hero { color: red; }
    #hero { color: black; }
    (a) black (b) purple (c) red (d) orange
  4. 4.📱 Which tag helps phones show a page at the right size? (a) the hr tag (b) the viewport meta tag (c) the title tag (d) the br tag
  5. 5.🌈 Which colour is #00ffff? (a) cyan (b) black (c) blue (d) bright green
  6. 6.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 190px;
      padding: 10px;
      border: 2px solid black;
      margin: 20px;
    }
  7. 7.🧩 Which language counts down a timer? (a) HTML (b) JavaScript (c) CSS
  8. 8.✍️ Which property is set to 2px solid in this rule?
    .note {
      border: 2px solid;
      text-align: center;
      background-color: yellow;
    }
    (a) font-style (b) width (c) 2px solid (d) border
  9. 9.🎯 Which element does the selector h1 style? (a) <li class="red"> (b) <h1 class="red"> (c) <h2> (d) <div id="end">
  10. 10.⚖️ Which selector is the weakest? (a) an element selector (b) a class selector (c) an id selector
  11. 11.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 40px;
      padding: 30px;
      border: 2px solid black;
      margin: 10px;
    }
  12. 12.🌈 What is the biggest number one colour can have in rgb()? (a) 100 (b) 1000 (c) 99 (d) 255
  13. 13.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 80px;
      padding: 10px;
      border: 3px solid black;
      margin: 5px;
    }
  14. 14.True or false: #logo is an id selector. (a) True (b) False
  15. 15.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 150px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 40px wide (no margins).
  16. 16.🎯 Which sign starts a class selector? (a) @ (b) & (c) . (d) #
  17. 17.📱 The screen is 700px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 14px;
      }
    }
    (a) Yes (b) No
  18. 18.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 250px;
      justify-content: flex-end;
    }
    Inside are 3 boxes, each 80px wide (no margins).
  19. 19.✍️ What value is given to margin in this rule?
    .note {
      width: 300px;
      font-style: italic;
      margin: 10px;
    }
    (a) 8px (b) margin (c) 10px (d) bold
  20. 20.💪 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 60px wide (no margins).
  21. 21.🌈 In #00f400 the green part is the hex number f4. What is it as a normal number?
  22. 22.Which of these does JavaScript do? (a) rounds box corners (b) puts a picture on a page (c) checks a quiz answer (d) sets colours and fonts
  23. 23.💪 Which flexbox property sets space between boxes? (a) align-items (b) justify-content (c) gap (d) display: flex
  24. 24.🎨 What does CSS stand for? (a) Computer Style Sheets (b) Creative Sheet System (c) Colourful Site Styles (d) Cascading Style Sheets
  25. 25.✍️ How many declarations (property: value pairs) are in this rule?
    h2 {
      font-weight: bold;
      border: 2px solid;
      font-size: 20px;
      background-color: yellow;
    }
  26. 26.💪 Which flexbox property spaces boxes along a row? (a) align-items (b) justify-content (c) gap (d) flex-direction
  27. 27.⚖️ What colour is the text of this element?
    <p class="menu" id="logo">Hi</p>
    CSS:
    #logo { color: green; }
    #logo { color: white; }
    (a) white (b) green (c) orange (d) black
  28. 28.🌈 Which colour is #000000? (a) red (b) white (c) black (d) blue
  29. 29.✍️ How many declarations (property: value pairs) are in this rule?
    h2 {
      font-style: italic;
      font-weight: bold;
      padding: 8px;
      font-size: 20px;
    }
  30. 30.What does justify-content: flex-end do? (a) puts boxes in the middle (b) equal gaps, none at ends (c) packs boxes at the end (d) packs boxes at the start
  31. 31.✍️ In color: blue; which part is the property? (a) ; (b) blue (c) : (d) color
  32. 32.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 320px;
      justify-content: space-between;
    }
    Inside are 3 boxes, each 60px wide (no margins).
  33. 33.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 140px;
      padding: 5px;
      border: 4px solid black;
      margin: 5px;
    }
  34. 34.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 280px;
      justify-content: flex-end;
    }
    Inside are 4 boxes, each 50px wide (no margins).
  35. 35.🖌️ How big is the text, in px?
    li {
      text-align: center;
      color: yellow;
      font-size: 20px;
      background-color: black;
    }
  36. 36.💪 Which justify-content value packs boxes at the end? (a) space-between (b) flex-end (c) center (d) flex-start
  37. 37.✍️ What value is given to font-size in this rule?
    #top {
      border: 2px solid;
      color: red;
      font-style: italic;
      font-size: 20px;
    }
    (a) 20px (b) yellow (c) font-size (d) center
  38. 38.✍️ What is the selector in this CSS rule?
    h2 {
      width: 300px;
      color: red;
    }
    (a) h1 (b) width (c) h2 (d) red
  39. 39.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the later one (b) neither (c) the shorter one (d) the first one
  40. 40.What does font-weight do? (a) makes letters bigger (b) centres a heading (c) picks the font style (d) makes the text bold

Answer key

  1. the screen width
  2. an id selector
  3. black
  4. the viewport meta tag
  5. cyan
  6. 254
  7. JavaScript
  8. border
  9. <h1 class="red">
  10. an element selector
  11. 124
  12. 255
  13. 116
  14. True
  15. 70
  16. .
  17. Yes
  18. 10
  19. 10px
  20. 10
  21. 244
  22. checks a quiz answer
  23. gap
  24. Cascading Style Sheets
  25. 4
  26. justify-content
  27. white
  28. black
  29. 4
  30. packs boxes at the end
  31. color
  32. 70
  33. 168
  34. 80
  35. 20
  36. flex-end
  37. 20px
  38. h2
  39. the later one
  40. makes the text bold

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