← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 798 · 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.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 300px;
      padding: 15px;
      border: 5px solid black;
      margin: 10px;
    }
  2. 2.🖌️ Where does the text sit on its line?
    li {
      color: green;
      font-size: 12px;
      background-color: red;
      text-align: right;
    }
    (a) on the right (b) on the left (c) in the middle
  3. 3.📱 max-width: 600px applies when the screen is ___. (a) 600px or wider (b) turned off (c) exactly 1000px (d) 600px or narrower
  4. 4.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 300px;
      padding: 25px;
      border: 4px solid black;
      margin: 15px;
    }
  5. 5.🌈 Which colour of light is strongest in rgb(89, 0, 242)? (a) blue (b) green (c) red
  6. 6.📱 What does a media query check? (a) the screen width (b) the page title (c) the time of day (d) the battery level
  7. 7.✍️ How many declarations (property: value pairs) are in this rule?
    .note {
      font-style: italic;
      color: red;
      font-size: 20px;
      width: 300px;
    }
  8. 8.📱 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;
      }
    }
  9. 9.What does color do? (a) makes letters bigger (b) centres a heading (c) picks the font style (d) sets the letter colour
  10. 10.💪 Which flexbox property spaces boxes along a row? (a) display: flex (b) align-items (c) justify-content (d) flex-direction
  11. 11.What does justify-content: flex-end do? (a) puts boxes in the middle (b) packs boxes at the end (c) equal gaps, none at ends (d) packs boxes at the start
  12. 12.🖌️ Which CSS property colours behind the text? (a) font-weight (b) color (c) text-align (d) background-color
  13. 13.✍️ Which sign ends each CSS declaration? (a) : (b) , (c) . (d) ;
  14. 14.✍️ What value is given to font-size in this rule?
    #top {
      border: 2px solid;
      font-size: 20px;
    }
    (a) center (b) font-size (c) yellow (d) 20px
  15. 15.✍️ In color: blue; which part is the property? (a) blue (b) ; (c) : (d) color
  16. 16.🔍 Which is the odd one out? (a) counts down a timer (b) shows a pop-up message (c) reacts to a button click (d) lays out the page
  17. 17.📱 The screen is 1366px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 28px;
      }
    }
    (a) Yes (b) No
  18. 18.⚖️ What colour is the text of this element?
    <p class="menu" id="top">Hi</p>
    CSS:
    p { color: green; }
    p { color: purple; }
    (a) purple (b) black (c) white (d) green
  19. 19.🎯 Can many elements share the same class? (a) Yes (b) No
  20. 20.⚖️ Two rules with the same selector set a colour. Which one wins? (a) neither (b) the later one (c) the shorter one (d) the first one
  21. 21.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 16px;
      }
    }
  22. 22.⚖️ What colour is the text of this element?
    <h2 class="note" id="logo">Hi</h2>
    CSS:
    h2 { color: purple; }
    .note { color: black; }
    #logo { color: white; }
    (a) purple (b) white (c) orange (d) black
  23. 23.📱 The screen is 414px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 14px;
      }
    }
    (a) Yes (b) No
  24. 24.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 130px;
      padding: 25px;
      border: 2px solid black;
      margin: 15px;
    }
  25. 25.✍️ How many declarations (property: value pairs) are in this rule?
    #top {
      margin: 10px;
    }
  26. 26.🌈 Which colour of light is strongest in rgb(56, 226, 46)? (a) green (b) red (c) blue
  27. 27.🌈 In #rrggbb, which colour do the last two digits give? (a) blue (b) white (c) red (d) green
  28. 28.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 8px;
      }
    }
  29. 29.✍️ Which property is set to bold in this rule?
    h2 {
      color: red;
      font-weight: bold;
      border: 2px solid;
    }
    (a) bold (b) border (c) font-weight (d) width
  30. 30.⚖️ What colour is the text of this element?
    <h1 class="red" id="top">Hi</h1>
    CSS:
    h1 { color: yellow; }
    h1 { color: green; }
    (a) blue (b) green (c) orange (d) yellow
  31. 31.🎯 Which element does the selector .star style? (a) <div class="star"> (b) <div id="star"> (c) <span class="note"> (d) <div class="menu">
  32. 32.📱 Responsive design means a page ___. (a) has no pictures (b) never changes (c) fits every screen (d) is only for laptops
  33. 33.💪 Which justify-content value equal gaps, none at ends? (a) flex-end (b) center (c) space-between (d) flex-start
  34. 34.What does font-family do? (a) makes letters bigger (b) centres a heading (c) picks the font style (d) makes the text bold
  35. 35.True or false: JavaScript adds space around boxes. (a) True (b) False
  36. 36.✍️ How many declarations (property: value pairs) are in this rule?
    #top {
      border: 2px solid;
    }
  37. 37.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 540px;
      justify-content: center;
    }
    Inside are 4 boxes, each 100px wide (no margins).
  38. 38.⚖️ What colour is the text of this element?
    <p class="note" id="end">Hi</p>
    CSS:
    p { color: black; }
    .note { color: purple; }
    (a) yellow (b) orange (c) black (d) purple
  39. 39.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 260px;
      justify-content: center;
    }
    Inside are 3 boxes, each 80px wide (no margins).
  40. 40.Which of these does CSS do? (a) sets colours and fonts (b) checks a quiz answer (c) puts a picture on a page (d) makes headings and lists

Answer key

  1. 340
  2. on the right
  3. 600px or narrower
  4. 388
  5. blue
  6. the screen width
  7. 4
  8. 24
  9. sets the letter colour
  10. justify-content
  11. packs boxes at the end
  12. background-color
  13. ;
  14. 20px
  15. color
  16. lays out the page
  17. Yes
  18. purple
  19. Yes
  20. the later one
  21. 12
  22. white
  23. Yes
  24. 214
  25. 1
  26. green
  27. blue
  28. 12
  29. font-weight
  30. green
  31. <div class="star">
  32. fits every screen
  33. space-between
  34. picks the font style
  35. False
  36. 1
  37. 70
  38. purple
  39. 10
  40. sets colours and fonts

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