← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 108 · 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.📱 Responsive design means a page ___. (a) never changes (b) has no pictures (c) fits every screen (d) is only for laptops
  2. 2.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 40px;
      padding: 30px;
      border: 1px solid black;
      margin: 15px;
    }
  3. 3.🖌️ What colour are the letters?
    p {
      font-size: 16px;
      text-align: center;
      color: red;
      background-color: white;
    }
    (a) red (b) white (c) green
  4. 4.⚖️ What colour is the text of this element?
    <p class="note" id="logo">Hi</p>
    CSS:
    p { color: green; }
    p { color: black; }
    (a) yellow (b) red (c) green (d) black
  5. 5.🎯 Which sign starts a class selector? (a) . (b) # (c) & (d) @
  6. 6.💪 Which flexbox property lines boxes up across? (a) justify-content (b) align-items (c) display: flex (d) flex-direction
  7. 7.🌈 Which colour of light is strongest in rgb(196, 90, 82)? (a) blue (b) green (c) red
  8. 8.🌈 Which colour is #0000ff? (a) red (b) bright green (c) blue (d) white
  9. 9.🎯 Which element does the selector #top style? (a) <li id="top"> (b) <div class="star"> (c) <li class="top"> (d) <li id="intro">
  10. 10.🖌️ What colour are the letters?
    p {
      background-color: blue;
      text-align: left;
      color: black;
      font-size: 20px;
    }
    (a) black (b) yellow (c) blue
  11. 11.⚖️ What colour is the text of this element?
    <p class="box" id="intro">Hi</p>
    CSS:
    p { color: red; }
    p { color: green; }
    (a) yellow (b) blue (c) red (d) green
  12. 12.🌈 In #000049 the blue part is the hex number 49. What is it as a normal number?
  13. 13.🌈 Which colour of light is strongest in rgb(138, 82, 151)? (a) green (b) blue (c) red
  14. 14.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 10px;
      }
    }
  15. 15.What does color do? (a) colours behind the text (b) picks the font style (c) centres a heading (d) sets the letter colour
  16. 16.What does font-family do? (a) centres a heading (b) makes letters bigger (c) colours behind the text (d) picks the font style
  17. 17.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 240px;
      padding: 5px;
      border: 2px solid black;
      margin: 15px;
    }
  18. 18.🎯 Which sign starts an id selector? (a) @ (b) # (c) . (d) &
  19. 19.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 270px;
      justify-content: space-between;
    }
    Inside are 2 boxes, each 100px wide (no margins).
  20. 20.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 80px;
      padding: 10px;
      border: 3px solid black;
      margin: 10px;
    }
  21. 21.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 120px;
      justify-content: space-between;
    }
    Inside are 2 boxes, each 50px wide (no margins).
  22. 22.✍️ What value is given to border in this rule?
    body {
      border: 2px solid;
      font-size: 20px;
      margin: 10px;
    }
    (a) 2px solid (b) italic (c) 300px (d) border
  23. 23.What does justify-content: space-between do? (a) puts boxes in the middle (b) packs boxes at the start (c) equal gaps, none at ends (d) packs boxes at the end
  24. 24.🌈 Which colour of light is strongest in rgb(242, 115, 92)? (a) red (b) green (c) blue
  25. 25.💪 Which justify-content value puts boxes in the middle? (a) flex-start (b) flex-end (c) center (d) space-between
  26. 26.📱 Which tag helps phones show a page at the right size? (a) the title tag (b) the br tag (c) the viewport meta tag (d) the hr tag
  27. 27.✍️ How many declarations (property: value pairs) are in this rule?
    #top {
      background-color: yellow;
      border: 2px solid;
      width: 300px;
    }
  28. 28.🖌️ Which CSS property picks the font style? (a) font-family (b) font-size (c) text-align (d) background-color
  29. 29.🔍 Which is the odd one out? (a) changes the page live (b) sets colours and fonts (c) lays out the page (d) changes the text size
  30. 30.📱 The screen is 1100px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 28px;
      }
    }
    (a) No (b) Yes
  31. 31.🎨 A CSS file usually ends with which extension? (a) .css (b) .png (c) .html (d) .js
  32. 32.⚖️ What colour is the text of this element?
    <h1 class="red" id="top">Hi</h1>
    CSS:
    h1 { color: white; }
    h1 { color: blue; }
    (a) purple (b) yellow (c) blue (d) white
  33. 33.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 4 (b) 2 (c) 6 (d) 3
  34. 34.⚖️ Which selector is the strongest? (a) an element selector (b) an id selector (c) a class selector
  35. 35.⚖️ What colour is the text of this element?
    <p class="star" id="hero">Hi</p>
    CSS:
    #hero { color: red; }
    p { color: blue; }
    (a) orange (b) blue (c) yellow (d) red
  36. 36.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 250px;
      justify-content: flex-end;
    }
    Inside are 2 boxes, each 100px wide (no margins).
  37. 37.💪 Which flexbox property spaces boxes along a row? (a) align-items (b) display: flex (c) justify-content (d) flex-direction
  38. 38.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 190px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 60px wide (no margins).
  39. 39.🧩 Which language counts down a timer? (a) HTML (b) JavaScript (c) CSS
  40. 40.🧩 Which language changes the text size? (a) HTML (b) JavaScript (c) CSS

Answer key

  1. fits every screen
  2. 132
  3. red
  4. black
  5. .
  6. align-items
  7. red
  8. blue
  9. <li id="top">
  10. black
  11. green
  12. 73
  13. blue
  14. 12
  15. sets the letter colour
  16. picks the font style
  17. 254
  18. #
  19. 70
  20. 106
  21. 20
  22. 2px solid
  23. equal gaps, none at ends
  24. red
  25. center
  26. the viewport meta tag
  27. 3
  28. font-family
  29. changes the page live
  30. Yes
  31. .css
  32. blue
  33. 3
  34. an id selector
  35. red
  36. 50
  37. justify-content
  38. 70
  39. JavaScript
  40. CSS

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