← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 653 · 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 CSS selector matches this element?
    <span class="red" id="intro">Hello</span>
    (a) #intro (b) p (c) .box (d) #red
  2. 2.🌈 Which hex code is yellow? (a) #ffff00 (b) #00ffff (c) #00ff00 (d) #000000
  3. 3.🔍 Which is the odd one out? (a) sets colours and fonts (b) changes the page live (c) adds space around boxes (d) changes the text size
  4. 4.💪 Which justify-content value puts boxes in the middle? (a) center (b) space-between (c) flex-end (d) flex-start
  5. 5.✍️ Which property is set to 10px in this rule?
    .note {
      margin: 10px;
      font-weight: bold;
    }
    (a) font-weight (b) 10px (c) margin (d) padding
  6. 6.🎯 What kind of selector is #main? (a) an id selector (b) a class selector (c) an element selector
  7. 7.True or false: HTML rounds box corners. (a) True (b) False
  8. 8.⚖️ What colour is the text of this element?
    <p class="red" id="main">Hi</p>
    CSS:
    p { color: orange; }
    p { color: blue; }
    (a) orange (b) white (c) blue (d) green
  9. 9.✍️ What value is given to text-align in this rule?
    .box {
      border: 2px solid;
      padding: 8px;
      text-align: center;
      color: red;
    }
    (a) yellow (b) center (c) text-align (d) 10px
  10. 10.⚖️ What colour is the text of this element?
    <p class="box" id="intro">Hi</p>
    CSS:
    p { color: green; }
    #intro { color: orange; }
    (a) green (b) yellow (c) red (d) orange
  11. 11.✍️ Which sign goes between a property and its value? (a) : (b) - (c) ; (d) =
  12. 12.🖌️ What colour is behind the letters?
    p {
      color: yellow;
      text-align: left;
      font-size: 36px;
      background-color: white;
    }
    (a) green (b) white (c) yellow
  13. 13.✍️ How does a CSS comment start? (a) /* (b) # (c) // (d) <!--
  14. 14.📦 In the box model, which part is space inside the border? (a) margin (b) content (c) padding (d) border
  15. 15.⚖️ What colour is the text of this element?
    <h1 class="menu" id="hero">Hi</h1>
    CSS:
    h1 { color: red; }
    .menu { color: green; }
    #hero { color: blue; }
    (a) blue (b) green (c) red (d) orange
  16. 16.Which of these does JavaScript do? (a) lays out the page (b) rounds box corners (c) adds space around boxes (d) shows a pop-up message
  17. 17.🌈 In #d90000 the red part is the hex number d9. What is it as a normal number?
  18. 18.✍️ Which property is set to 20px in this rule?
    body {
      font-size: 20px;
      text-align: center;
      margin: 10px;
    }
    (a) text-align (b) background-color (c) 20px (d) font-size
  19. 19.🌈 In #rrggbb, which colour do the first two digits give? (a) red (b) black (c) blue (d) green
  20. 20.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 250px;
      justify-content: flex-start;
    }
    Inside are 4 boxes, each 60px wide (no margins).
  21. 21.⚖️ What colour is the text of this element?
    <p class="note" id="end">Hi</p>
    CSS:
    #end { color: red; }
    p { color: blue; }
    (a) purple (b) red (c) blue (d) white
  22. 22.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 12px;
      }
    }
  23. 23.⚖️ What colour is the text of this element?
    <p class="box" id="main">Hi</p>
    CSS:
    #main { color: yellow; }
    p { color: green; }
    .box { color: orange; }
    (a) green (b) orange (c) yellow (d) red
  24. 24.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 6px;
      }
    }
    (a) No (b) Yes
  25. 25.🎯 Which sign starts a class selector? (a) @ (b) & (c) # (d) .
  26. 26.🌈 In #000047 the blue part is the hex number 47. What is it as a normal number?
  27. 27.What does justify-content: flex-end do? (a) puts boxes in the middle (b) packs boxes at the start (c) equal gaps, none at ends (d) packs boxes at the end
  28. 28.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 120px;
      padding: 5px;
      border: 5px solid black;
      margin: 5px;
    }
  29. 29.⚖️ What colour is the text of this element?
    <h1 class="red" id="top">Hi</h1>
    CSS:
    .red { color: red; }
    .red { color: blue; }
    (a) white (b) green (c) red (d) blue
  30. 30.⚖️ Which selector is the weakest? (a) a class selector (b) an id selector (c) an element selector
  31. 31.📱 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;
      }
    }
  32. 32.✍️ How many declarations (property: value pairs) are in this rule?
    .box {
      font-weight: bold;
    }
  33. 33.⚖️ Which selector is the strongest? (a) an element selector (b) an id selector (c) a class selector
  34. 34.🎨 A CSS file usually ends with which extension? (a) .png (b) .css (c) .js (d) .html
  35. 35.✍️ In color: blue; which part is the property? (a) ; (b) : (c) blue (d) color
  36. 36.📱 max-width: 600px applies when the screen is ___. (a) 600px or wider (b) exactly 1000px (c) turned off (d) 600px or narrower
  37. 37.🖌️ What colour is behind the letters?
    h1 {
      background-color: black;
      text-align: left;
      font-size: 16px;
      color: purple;
    }
    (a) purple (b) black (c) orange
  38. 38.✍️ Which property is set to bold in this rule?
    #top {
      color: red;
      font-weight: bold;
    }
    (a) border (b) bold (c) width (d) font-weight
  39. 39.⚖️ What colour is the text of this element?
    <h1 class="big" id="logo">Hi</h1>
    CSS:
    #logo { color: purple; }
    .big { color: orange; }
    (a) purple (b) white (c) orange (d) green
  40. 40.🔍 Which is the odd one out? (a) lays out the page (b) makes a link (c) changes the text size (d) adds space around boxes

Answer key

  1. #intro
  2. #ffff00
  3. changes the page live
  4. center
  5. margin
  6. an id selector
  7. False
  8. blue
  9. center
  10. orange
  11. :
  12. white
  13. /*
  14. padding
  15. blue
  16. shows a pop-up message
  17. 217
  18. font-size
  19. red
  20. 10
  21. red
  22. 12
  23. yellow
  24. Yes
  25. .
  26. 71
  27. packs boxes at the end
  28. 140
  29. blue
  30. an element selector
  31. 16
  32. 1
  33. an id selector
  34. .css
  35. color
  36. 600px or narrower
  37. black
  38. font-weight
  39. purple
  40. makes a link

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