← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 412 · 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.⚖️ What colour is the text of this element?
    <h1 class="box" id="top">Hi</h1>
    CSS:
    .box { color: blue; }
    .box { color: orange; }
    (a) black (b) white (c) blue (d) orange
  2. 2.✍️ How many declarations (property: value pairs) are in this rule?
    #top {
      font-style: italic;
      margin: 10px;
    }
  3. 3.✍️ How many declarations (property: value pairs) are in this rule?
    .note {
      font-style: italic;
      width: 300px;
      font-size: 20px;
      text-align: center;
    }
  4. 4.⚖️ What colour is the text of this element?
    <p class="box" id="end">Hi</p>
    CSS:
    .box { color: purple; }
    p { color: green; }
    (a) blue (b) green (c) white (d) purple
  5. 5.🌈 In #rrggbb, which colour do the last two digits give? (a) blue (b) white (c) green (d) red
  6. 6.🖌️ How big is the text, in px?
    li {
      color: blue;
      font-size: 12px;
      background-color: yellow;
      text-align: center;
    }
  7. 7.🖌️ Which CSS property makes letters bigger? (a) background-color (b) font-weight (c) font-size (d) font-family
  8. 8.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 330px;
      justify-content: flex-end;
    }
    Inside are 3 boxes, each 100px wide (no margins).
  9. 9.🌈 In #000002 the blue part is the hex number 02. What is it as a normal number?
  10. 10.⚖️ Which selector is the strongest? (a) a class selector (b) an id selector (c) an element selector
  11. 11.✍️ What is the selector in this CSS rule?
    #top {
      border: 2px solid;
      font-style: italic;
      padding: 8px;
    }
    (a) #top (b) li (c) italic (d) border
  12. 12.True or false: padding is space inside the border. (a) False (b) True
  13. 13.🎯 What kind of selector is .star? (a) an element selector (b) a class selector (c) an id selector
  14. 14.🔍 Which is the odd one out? (a) lays out the page (b) changes the page live (c) rounds box corners (d) changes the text size
  15. 15.🎯 Can many elements share the same class? (a) Yes (b) No
  16. 16.✍️ What value is given to padding in this rule?
    .box {
      color: red;
      padding: 8px;
      border: 2px solid;
      margin: 10px;
    }
    (a) bold (b) padding (c) 8px (d) 2px solid
  17. 17.📱 max-width: 600px applies when the screen is ___. (a) exactly 1000px (b) turned off (c) 600px or wider (d) 600px or narrower
  18. 18.What does justify-content: flex-start do? (a) equal gaps, none at ends (b) packs boxes at the start (c) packs boxes at the end (d) puts boxes in the middle
  19. 19.🖌️ Which CSS property colours behind the text? (a) font-family (b) font-size (c) background-color (d) font-weight
  20. 20.🌈 Which colour is #ff00ff? (a) cyan (b) blue (c) magenta (d) white
  21. 21.💪 Which flexbox property turns on flexbox? (a) flex-direction (b) align-items (c) justify-content (d) display: flex
  22. 22.✍️ How many declarations (property: value pairs) are in this rule?
    body {
      background-color: yellow;
      border: 2px solid;
    }
  23. 23.✍️ What value is given to font-weight in this rule?
    h1 {
      background-color: yellow;
      font-weight: bold;
      font-style: italic;
    }
    (a) font-weight (b) bold (c) 2px solid (d) 300px
  24. 24.🖌️ How big is the text, in px?
    p {
      color: green;
      text-align: right;
      font-size: 32px;
      background-color: purple;
    }
  25. 25.✍️ Which property is set to center in this rule?
    .box {
      border: 2px solid;
      text-align: center;
    }
    (a) margin (b) background-color (c) center (d) text-align
  26. 26.✍️ How many declarations (property: value pairs) are in this rule?
    body {
      font-size: 20px;
      background-color: yellow;
    }
  27. 27.🔍 Which is the odd one out? (a) gives the page structure (b) shows a pop-up message (c) makes a link (d) puts a picture on a page
  28. 28.🖌️ Where does the text sit on its line?
    h2 {
      font-size: 32px;
      text-align: right;
      color: red;
      background-color: white;
    }
    (a) in the middle (b) on the right (c) on the left
  29. 29.🎯 Which element does the selector .big style? (a) <h1 class="box"> (b) <p class="red"> (c) <p id="big"> (d) <p class="big">
  30. 30.⚖️ What colour is the text of this element?
    <h1 class="red" id="top">Hi</h1>
    CSS:
    h1 { color: blue; }
    #top { color: red; }
    .red { color: purple; }
    (a) red (b) purple (c) blue (d) white
  31. 31.🌈 Hex digits go 0 to 9, then A to which letter? (a) F (b) G (c) Z (d) J
  32. 32.Which of these does JavaScript do? (a) lays out the page (b) adds space around boxes (c) gives the page structure (d) counts down a timer
  33. 33.🎯 Which element does the selector #top style? (a) <p class="top"> (b) <p id="top"> (c) <h1 class="note"> (d) <p id="intro">
  34. 34.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 14px;
      }
    }
    (a) Yes (b) No
  35. 35.What does font-weight do? (a) sets the letter colour (b) picks the font style (c) makes the text bold (d) makes letters bigger
  36. 36.🌈 In #00001a the blue part is the hex number 1a. What is it as a normal number?
  37. 37.⚖️ What colour is the text of this element?
    <p class="note" id="hero">Hi</p>
    CSS:
    .note { color: yellow; }
    .note { color: white; }
    (a) green (b) yellow (c) white (d) blue
  38. 38.💪 Which justify-content value equal gaps, none at ends? (a) flex-start (b) space-between (c) center (d) flex-end
  39. 39.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 530px;
      justify-content: space-between;
    }
    Inside are 4 boxes, each 80px wide (no margins).
  40. 40.⚖️ What colour is the text of this element?
    <h2 class="menu" id="logo">Hi</h2>
    CSS:
    .menu { color: blue; }
    #logo { color: red; }
    (a) orange (b) red (c) white (d) blue

Answer key

  1. orange
  2. 2
  3. 4
  4. purple
  5. blue
  6. 12
  7. font-size
  8. 30
  9. 2
  10. an id selector
  11. #top
  12. True
  13. a class selector
  14. changes the page live
  15. Yes
  16. 8px
  17. 600px or narrower
  18. packs boxes at the start
  19. background-color
  20. magenta
  21. display: flex
  22. 2
  23. bold
  24. 32
  25. text-align
  26. 2
  27. shows a pop-up message
  28. on the right
  29. <p class="big">
  30. red
  31. F
  32. counts down a timer
  33. <p id="top">
  34. Yes
  35. makes the text bold
  36. 26
  37. white
  38. space-between
  39. 70
  40. red

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