← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 500 · 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 padding? (a) the gap to other boxes (b) a solid or dotted edge (c) the gap round content (d) the line round the box
  2. 2.🌈 In #000b00 the green part is the hex number 0b. What is it as a normal number?
  3. 3.📱 Responsive design means a page ___. (a) is only for laptops (b) never changes (c) has no pictures (d) fits every screen
  4. 4.🎯 What kind of selector is .big? (a) an id selector (b) an element selector (c) a class selector
  5. 5.🎯 Which CSS selector matches this element?
    <h1 class="big" id="main">Hello</h1>
    (a) #big (b) .main (c) #logo (d) h1
  6. 6.📱 max-width: 600px applies when the screen is ___. (a) 600px or narrower (b) turned off (c) 600px or wider (d) exactly 1000px
  7. 7.True or false: margin is space inside the border. (a) True (b) False
  8. 8.📦 In the box model, which part is space inside the border? (a) content (b) padding (c) border (d) margin
  9. 9.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 14px;
      }
    }
  10. 10.🌈 Which colour is rgb(0, 0, 255)? (a) blue (b) white (c) cyan (d) magenta
  11. 11.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 410px;
      justify-content: space-between;
    }
    Inside are 4 boxes, each 80px wide (no margins).
  12. 12.📱 The screen is 700px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 16px;
      }
    }
    (a) No (b) Yes
  13. 13.🎯 Which element does the selector #hero style? (a) <span class="hero"> (b) <span id="top"> (c) <p class="red"> (d) <span id="hero">
  14. 14.Which of these does JavaScript do? (a) adds space around boxes (b) reacts to a button click (c) changes the text size (d) puts a picture on a page
  15. 15.⚖️ Which selector is the weakest? (a) a class selector (b) an element selector (c) an id selector
  16. 16.⚖️ What colour is the text of this element?
    <h2 class="star" id="hero">Hi</h2>
    CSS:
    h2 { color: purple; }
    #hero { color: green; }
    .star { color: yellow; }
    (a) green (b) red (c) yellow (d) purple
  17. 17.⚖️ What colour is the text of this element?
    <h2 class="menu" id="top">Hi</h2>
    CSS:
    h2 { color: red; }
    h2 { color: green; }
    (a) yellow (b) black (c) green (d) red
  18. 18.⚖️ Which selector is the strongest? (a) an element selector (b) an id selector (c) a class selector
  19. 19.🖌️ Which CSS property colours behind the text? (a) color (b) font-weight (c) text-align (d) background-color
  20. 20.🖌️ What colour is behind the letters?
    h1 {
      background-color: purple;
      font-size: 20px;
      text-align: center;
      color: green;
    }
    (a) white (b) purple (c) green
  21. 21.True or false: HTML makes a form box. (a) True (b) False
  22. 22.True or false: padding is space inside the border. (a) False (b) True
  23. 23.📱 The screen is 1366px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 24px;
      }
    }
    (a) Yes (b) No
  24. 24.✍️ What value is given to font-style in this rule?
    .note {
      font-style: italic;
      font-size: 20px;
    }
    (a) font-style (b) 20px (c) red (d) italic
  25. 25.🎯 Which element does the selector .big style? (a) <li class="big"> (b) <li class="red"> (c) <div class="box"> (d) <li id="big">
  26. 26.✍️ CSS declarations go inside which brackets? (a) < > (b) ( ) (c) [ ] (d) { }
  27. 27.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 12px;
      }
    }
    (a) Yes (b) No
  28. 28.⚖️ What colour is the text of this element?
    <p class="menu" id="end">Hi</p>
    CSS:
    .menu { color: yellow; }
    .menu { color: blue; }
    (a) blue (b) yellow (c) green (d) red
  29. 29.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 200px;
      padding: 30px;
      border: 5px solid black;
      margin: 20px;
    }
  30. 30.🌈 In #bf0000 the red part is the hex number bf. What is it as a normal number?
  31. 31.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 220px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 80px wide (no margins).
  32. 32.🌈 In #rrggbb, which colour do the first two digits give? (a) green (b) black (c) blue (d) red
  33. 33.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 150px;
      justify-content: flex-end;
    }
    Inside are 2 boxes, each 40px wide (no margins).
  34. 34.✍️ How many declarations (property: value pairs) are in this rule?
    .box {
      font-weight: bold;
    }
  35. 35.✍️ Which sign ends each CSS declaration? (a) : (b) , (c) . (d) ;
  36. 36.🎯 Which CSS selector matches this element?
    <span class="big" id="intro">Hello</span>
    (a) #big (b) .red (c) .big (d) .intro
  37. 37.🎯 Which sign starts a class selector? (a) . (b) # (c) & (d) @
  38. 38.💪 Which justify-content value equal gaps, none at ends? (a) flex-end (b) flex-start (c) center (d) space-between
  39. 39.✍️ How many declarations (property: value pairs) are in this rule?
    li {
      width: 300px;
      background-color: yellow;
    }
  40. 40.⚖️ What colour is the text of this element?
    <h2 class="note" id="logo">Hi</h2>
    CSS:
    h2 { color: orange; }
    h2 { color: red; }
    (a) orange (b) red (c) white (d) blue

Answer key

  1. the gap round content
  2. 11
  3. fits every screen
  4. a class selector
  5. h1
  6. 600px or narrower
  7. False
  8. padding
  9. 16
  10. blue
  11. 30
  12. Yes
  13. <span id="hero">
  14. reacts to a button click
  15. an element selector
  16. green
  17. green
  18. an id selector
  19. background-color
  20. purple
  21. True
  22. True
  23. Yes
  24. italic
  25. <li class="big">
  26. { }
  27. Yes
  28. blue
  29. 270
  30. 191
  31. 60
  32. red
  33. 70
  34. 1
  35. ;
  36. .big
  37. .
  38. space-between
  39. 2
  40. red

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