← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 974 · 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 gap round content (c) a solid or dotted edge (d) space outside the border
  2. 2.🌈 Which colour is rgb(255, 0, 0)? (a) magenta (b) red (c) blue (d) yellow
  3. 3.🌈 Which colour is rgb(0, 0, 255)? (a) blue (b) yellow (c) bright green (d) white
  4. 4.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 210px;
      justify-content: flex-end;
    }
    Inside are 3 boxes, each 50px wide (no margins).
  5. 5.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 14px;
      }
    }
    (a) No (b) Yes
  6. 6.🖌️ Where does the text sit on its line?
    h1 {
      background-color: white;
      color: red;
      text-align: right;
      font-size: 24px;
    }
    (a) in the middle (b) on the left (c) on the right
  7. 7.🌈 Which colour is #00ffff? (a) cyan (b) bright green (c) white (d) magenta
  8. 8.✍️ How many declarations (property: value pairs) are in this rule?
    body {
      font-weight: bold;
      margin: 10px;
      color: red;
      font-style: italic;
    }
  9. 9.💪 Which justify-content value equal gaps, none at ends? (a) center (b) space-between (c) flex-end (d) flex-start
  10. 10.True or false: .note is an id selector. (a) False (b) True
  11. 11.What does font-size do? (a) colours behind the text (b) picks the font style (c) makes letters bigger (d) makes the text bold
  12. 12.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 260px;
      justify-content: flex-start;
    }
    Inside are 4 boxes, each 60px wide (no margins).
  13. 13.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 6px;
      }
    }
  14. 14.🎯 What kind of selector is h1? (a) a class selector (b) an id selector (c) an element selector
  15. 15.📦 In the box model, which part is the text or picture? (a) border (b) content (c) margin (d) padding
  16. 16.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 80px;
      padding: 5px;
      border: 5px solid black;
      margin: 20px;
    }
  17. 17.🧩 Which language sets colours and fonts? (a) JavaScript (b) HTML (c) CSS
  18. 18.✍️ Which property is set to 10px in this rule?
    .note {
      width: 300px;
      text-align: center;
      margin: 10px;
    }
    (a) 10px (b) font-weight (c) margin (d) padding
  19. 19.🖌️ What colour is behind the letters?
    p {
      text-align: left;
      font-size: 24px;
      background-color: green;
      color: orange;
    }
    (a) white (b) green (c) orange
  20. 20.🖌️ Which CSS property picks the font style? (a) font-family (b) background-color (c) font-size (d) font-weight
  21. 21.✍️ In color: blue; which part is the property? (a) color (b) : (c) blue (d) ;
  22. 22.⚖️ What colour is the text of this element?
    <h1 class="red" id="top">Hi</h1>
    CSS:
    h1 { color: red; }
    #top { color: white; }
    (a) white (b) blue (c) red (d) black
  23. 23.🧩 Which language makes a form box? (a) JavaScript (b) HTML (c) CSS
  24. 24.🎨 Which tag holds CSS inside the head? (a) <css> (b) <body> (c) <style> (d) <script>
  25. 25.🎯 Which CSS selector matches this element?
    <h2 class="big" id="intro">Hello</h2>
    (a) .intro (b) #big (c) #main (d) h2
  26. 26.✍️ What value is given to color in this rule?
    body {
      border: 2px solid;
      background-color: yellow;
      color: red;
    }
    (a) color (b) center (c) 20px (d) red
  27. 27.🖌️ Where does the text sit on its line?
    li {
      color: black;
      background-color: white;
      text-align: right;
      font-size: 36px;
    }
    (a) in the middle (b) on the right (c) on the left
  28. 28.✍️ What value is given to font-weight in this rule?
    body {
      border: 2px solid;
      font-weight: bold;
    }
    (a) 300px (b) font-weight (c) 2px solid (d) bold
  29. 29.🎯 Which element does the selector .star style? (a) <li id="star"> (b) <li class="menu"> (c) <li class="star"> (d) <div class="note">
  30. 30.📱 What does a media query check? (a) the page title (b) the battery level (c) the time of day (d) the screen width
  31. 31.True or false: padding is the gap to other boxes. (a) True (b) False
  32. 32.✍️ What value is given to margin in this rule?
    p {
      margin: 10px;
      text-align: center;
    }
    (a) bold (b) 8px (c) 10px (d) margin
  33. 33.📦 In the box model, which part is the gap to other boxes? (a) border (b) content (c) margin (d) padding
  34. 34.⚖️ What colour is the text of this element?
    <h2 class="note" id="hero">Hi</h2>
    CSS:
    #hero { color: white; }
    h2 { color: black; }
    .note { color: yellow; }
    (a) red (b) yellow (c) black (d) white
  35. 35.🖌️ Which CSS property makes letters bigger? (a) background-color (b) color (c) text-align (d) font-size
  36. 36.What does justify-content: space-between do? (a) packs boxes at the end (b) packs boxes at the start (c) puts boxes in the middle (d) equal gaps, none at ends
  37. 37.🌈 Which hex code is magenta? (a) #0000ff (b) #ff00ff (c) #ff0000 (d) #000000
  38. 38.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 260px;
      padding: 30px;
      border: 4px solid black;
      margin: 5px;
    }
  39. 39.🌈 Which colour of light is strongest in rgb(43, 166, 119)? (a) red (b) blue (c) green
  40. 40.🌈 Hex digits go 0 to 9, then A to which letter? (a) G (b) F (c) Z (d) J

Answer key

  1. a solid or dotted edge
  2. red
  3. blue
  4. 60
  5. Yes
  6. on the right
  7. cyan
  8. 4
  9. space-between
  10. False
  11. makes letters bigger
  12. 20
  13. 6
  14. an element selector
  15. content
  16. 140
  17. CSS
  18. margin
  19. green
  20. font-family
  21. color
  22. white
  23. HTML
  24. <style>
  25. h2
  26. red
  27. on the right
  28. bold
  29. <li class="star">
  30. the screen width
  31. False
  32. 10px
  33. margin
  34. white
  35. font-size
  36. equal gaps, none at ends
  37. #ff00ff
  38. 328
  39. green
  40. F

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