← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 526 · 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.📱 The screen is 1100px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 18px;
      }
    }
    (a) No (b) Yes
  2. 2.🌈 In #000027 the blue part is the hex number 27. What is it as a normal number?
  3. 3.True or false: padding is space inside the border. (a) False (b) True
  4. 4.Which of these does CSS do? (a) counts down a timer (b) reacts to a button click (c) rounds box corners (d) shows a pop-up message
  5. 5.💪 Which flexbox property lines boxes up across? (a) display: flex (b) align-items (c) flex-direction (d) justify-content
  6. 6.🎯 What kind of selector is .big? (a) an id selector (b) an element selector (c) a class selector
  7. 7.🎨 Which attribute adds CSS inside one tag? (a) href (b) style (c) src (d) alt
  8. 8.🌈 Which colour of light is strongest in rgb(26, 41, 253)? (a) blue (b) red (c) green
  9. 9.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 240px;
      justify-content: flex-start;
    }
    Inside are 4 boxes, each 40px wide (no margins).
  10. 10.🌈 Hex digits go 0 to 9, then A to which letter? (a) F (b) J (c) G (d) Z
  11. 11.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 80px;
      padding: 5px;
      border: 1px solid black;
      margin: 15px;
    }
  12. 12.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 18px;
      }
    }
  13. 13.📱 What does a media query check? (a) the battery level (b) the time of day (c) the page title (d) the screen width
  14. 14.What does color do? (a) centres a heading (b) colours behind the text (c) sets the letter colour (d) picks the font style
  15. 15.What does justify-content: space-between do? (a) packs boxes at the start (b) packs boxes at the end (c) puts boxes in the middle (d) equal gaps, none at ends
  16. 16.🌈 Which colour is #000000? (a) black (b) yellow (c) blue (d) white
  17. 17.✍️ Which property is set to bold in this rule?
    body {
      background-color: yellow;
      width: 300px;
      border: 2px solid;
      font-weight: bold;
    }
    (a) font-weight (b) width (c) bold (d) border
  18. 18.🖌️ What colour is behind the letters?
    h1 {
      color: green;
      background-color: purple;
      font-size: 16px;
      text-align: left;
    }
    (a) green (b) orange (c) purple
  19. 19.⚖️ What colour is the text of this element?
    <h1 class="star" id="intro">Hi</h1>
    CSS:
    h1 { color: orange; }
    h1 { color: red; }
    (a) green (b) purple (c) orange (d) red
  20. 20.🌈 Which colour is #00ff00? (a) bright green (b) white (c) yellow (d) red
  21. 21.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 24px;
      }
    }
  22. 22.True or false: JavaScript counts down a timer. (a) False (b) True
  23. 23.True or false: HTML shows a pop-up message. (a) False (b) True
  24. 24.✍️ What value is given to font-weight in this rule?
    h2 {
      font-weight: bold;
      background-color: yellow;
      text-align: center;
    }
    (a) 2px solid (b) 300px (c) bold (d) font-weight
  25. 25.📦 In the box model, which part is a solid or dotted edge? (a) content (b) padding (c) border (d) margin
  26. 26.✍️ CSS declarations go inside which brackets? (a) [ ] (b) { } (c) ( ) (d) < >
  27. 27.💪 Which justify-content value equal gaps, none at ends? (a) flex-start (b) center (c) flex-end (d) space-between
  28. 28.🎯 Which CSS selector matches this element?
    <li class="star" id="end">Hello</li>
    (a) .end (b) .menu (c) div (d) li
  29. 29.True or false: JavaScript makes a form box. (a) True (b) False
  30. 30.✍️ Which sign goes between a property and its value? (a) - (b) = (c) : (d) ;
  31. 31.True or false: padding is the gap to other boxes. (a) True (b) False
  32. 32.🌈 Which colour is rgb(255, 255, 0)? (a) cyan (b) bright green (c) yellow (d) black
  33. 33.💪 Which justify-content value packs boxes at the start? (a) flex-end (b) space-between (c) flex-start (d) center
  34. 34.🌈 In #rrggbb, which colour do the last two digits give? (a) blue (b) white (c) red (d) green
  35. 35.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 20px;
      }
    }
  36. 36.🔍 Which is the odd one out? (a) gives the page structure (b) lays out the page (c) changes the text size (d) adds space around boxes
  37. 37.🌈 Which colour is rgb(255, 0, 255)? (a) blue (b) yellow (c) magenta (d) black
  38. 38.Which of these does HTML do? (a) sets colours and fonts (b) checks a quiz answer (c) makes a form box (d) changes the text size
  39. 39.🖌️ What colour is behind the letters?
    h2 {
      text-align: center;
      background-color: orange;
      font-size: 40px;
      color: blue;
    }
    (a) blue (b) orange (c) white
  40. 40.✍️ What value is given to background-color in this rule?
    h1 {
      background-color: yellow;
      color: red;
      width: 300px;
      font-style: italic;
    }
    (a) 8px (b) yellow (c) 10px (d) background-color

Answer key

  1. Yes
  2. 39
  3. True
  4. rounds box corners
  5. align-items
  6. a class selector
  7. style
  8. blue
  9. 80
  10. F
  11. 122
  12. 18
  13. the screen width
  14. sets the letter colour
  15. equal gaps, none at ends
  16. black
  17. font-weight
  18. purple
  19. red
  20. bright green
  21. 16
  22. True
  23. False
  24. bold
  25. border
  26. { }
  27. space-between
  28. li
  29. False
  30. :
  31. False
  32. yellow
  33. flex-start
  34. blue
  35. 20
  36. gives the page structure
  37. magenta
  38. makes a form box
  39. orange
  40. yellow

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