← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 279 · 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 of these is the border? (a) space inside the border (b) the text or picture (c) a solid or dotted edge (d) space outside the border
  2. 2.🖌️ How big is the text, in px?
    li {
      font-size: 36px;
      text-align: right;
      color: red;
      background-color: blue;
    }
  3. 3.✍️ How many declarations (property: value pairs) are in this rule?
    h2 {
      font-size: 20px;
    }
  4. 4.🖌️ Which CSS property makes letters bigger? (a) color (b) font-family (c) font-size (d) background-color
  5. 5.🌈 In #0000c6 the blue part is the hex number c6. What is it as a normal number?
  6. 6.🎨 Which tag connects an outside CSS file? (a) <img> (b) <a> (c) <link> (d) <css>
  7. 7.🧩 Which language rounds box corners? (a) HTML (b) CSS (c) JavaScript
  8. 8.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 330px;
      justify-content: flex-start;
    }
    Inside are 4 boxes, each 80px wide (no margins).
  9. 9.✍️ Which property is set to 10px in this rule?
    #top {
      margin: 10px;
      font-weight: bold;
    }
    (a) font-weight (b) margin (c) padding (d) 10px
  10. 10.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 230px;
      justify-content: flex-start;
    }
    Inside are 4 boxes, each 50px wide (no margins).
  11. 11.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 28px;
      }
    }
  12. 12.🌈 In #rrggbb, which colour do the last two digits give? (a) blue (b) white (c) green (d) red
  13. 13.🎯 Can many elements share the same class? (a) Yes (b) No
  14. 14.✍️ How many declarations (property: value pairs) are in this rule?
    #top {
      margin: 10px;
      color: red;
      padding: 8px;
      border: 2px solid;
    }
  15. 15.🎨 A CSS file usually ends with which extension? (a) .html (b) .js (c) .css (d) .png
  16. 16.✍️ What is the selector in this CSS rule?
    body {
      padding: 8px;
      font-size: 20px;
    }
    (a) 20px (b) padding (c) body (d) .box
  17. 17.🖌️ Which CSS property makes the text bold? (a) color (b) font-weight (c) text-align (d) font-size
  18. 18.✍️ In color: blue; which part is the value? (a) ; (b) : (c) color (d) blue
  19. 19.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 240px;
      justify-content: center;
    }
    Inside are 3 boxes, each 60px wide (no margins).
  20. 20.✍️ How many declarations (property: value pairs) are in this rule?
    .box {
      padding: 8px;
    }
  21. 21.📱 Which tag helps phones show a page at the right size? (a) the br tag (b) the hr tag (c) the title tag (d) the viewport meta tag
  22. 22.True or false: margin is space outside the border. (a) False (b) True
  23. 23.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 20px;
      }
    }
    (a) No (b) Yes
  24. 24.True or false: .card is an id selector. (a) True (b) False
  25. 25.📱 The screen is 540px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 20px;
      }
    }
    (a) No (b) Yes
  26. 26.📱 Responsive design means a page ___. (a) fits every screen (b) is only for laptops (c) never changes (d) has no pictures
  27. 27.🧩 Which language makes a link? (a) CSS (b) HTML (c) JavaScript
  28. 28.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 14px;
      }
    }
  29. 29.🖌️ How big is the text, in px?
    h2 {
      font-size: 40px;
      color: green;
      text-align: left;
      background-color: white;
    }
  30. 30.🔍 Which is the odd one out? (a) changes the text size (b) lays out the page (c) adds space around boxes (d) changes the page live
  31. 31.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 70px;
      padding: 10px;
      border: 5px solid black;
      margin: 10px;
    }
  32. 32.🎯 Which sign starts a class selector? (a) & (b) # (c) . (d) @
  33. 33.🌈 In #00ee00 the green part is the hex number ee. What is it as a normal number?
  34. 34.🖌️ Where does the text sit on its line?
    h2 {
      text-align: left;
      font-size: 32px;
      color: purple;
      background-color: yellow;
    }
    (a) in the middle (b) on the right (c) on the left
  35. 35.True or false: #logo is an id selector. (a) False (b) True
  36. 36.⚖️ What colour is the text of this element?
    <p class="red" id="end">Hi</p>
    CSS:
    #end { color: orange; }
    #end { color: purple; }
    (a) black (b) purple (c) orange (d) white
  37. 37.🌈 Which colour is rgb(0, 255, 0)? (a) red (b) cyan (c) white (d) bright green
  38. 38.📱 The screen is 700px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 16px;
      }
    }
    (a) Yes (b) No
  39. 39.✍️ What is the selector in this CSS rule?
    #top {
      font-size: 20px;
      width: 300px;
      margin: 10px;
      color: red;
    }
    (a) #top (b) li (c) font-size (d) 300px
  40. 40.⚖️ What colour is the text of this element?
    <h1 class="note" id="end">Hi</h1>
    CSS:
    #end { color: black; }
    .note { color: green; }
    h1 { color: red; }
    (a) red (b) green (c) white (d) black

Answer key

  1. a solid or dotted edge
  2. 36
  3. 1
  4. font-size
  5. 198
  6. <link>
  7. CSS
  8. 10
  9. margin
  10. 30
  11. 28
  12. blue
  13. Yes
  14. 4
  15. .css
  16. body
  17. font-weight
  18. blue
  19. 30
  20. 1
  21. the viewport meta tag
  22. True
  23. No
  24. False
  25. No
  26. fits every screen
  27. HTML
  28. 20
  29. 40
  30. changes the page live
  31. 120
  32. .
  33. 238
  34. on the left
  35. True
  36. purple
  37. bright green
  38. No
  39. #top
  40. black

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