← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 468 · 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 colour is #ffffff? (a) yellow (b) magenta (c) red (d) white
  2. 2.🧩 Which language lays out the page? (a) HTML (b) JavaScript (c) CSS
  3. 3.🎨 A CSS file usually ends with which extension? (a) .js (b) .png (c) .html (d) .css
  4. 4.✍️ Which sign ends each CSS declaration? (a) . (b) ; (c) , (d) :
  5. 5.🖌️ Where does the text sit on its line?
    h1 {
      text-align: center;
      background-color: orange;
      font-size: 40px;
      color: blue;
    }
    (a) on the left (b) on the right (c) in the middle
  6. 6.✍️ Which sign goes between a property and its value? (a) : (b) ; (c) - (d) =
  7. 7.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 22px;
      }
    }
  8. 8.🎯 Which element does the selector .big style? (a) <h2 id="big"> (b) <li class="box"> (c) <h2 class="red"> (d) <h2 class="big">
  9. 9.🎯 What kind of selector is li? (a) an element selector (b) an id selector (c) a class selector
  10. 10.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 180px;
      padding: 20px;
      border: 2px solid black;
      margin: 0px;
    }
  11. 11.🎯 Which CSS selector matches this element?
    <span class="big" id="main">Hello</span>
    (a) .red (b) .main (c) span (d) p
  12. 12.📱 The screen is 540px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 26px;
      }
    }
    (a) Yes (b) No
  13. 13.🎯 Which CSS selector matches this element?
    <h1 class="note" id="main">Hello</h1>
    (a) .big (b) #note (c) #logo (d) .note
  14. 14.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 10px;
      }
    }
    (a) No (b) Yes
  15. 15.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 14px;
      }
    }
  16. 16.🌈 Which colour is rgb(255, 0, 255)? (a) cyan (b) white (c) magenta (d) black
  17. 17.📱 min-width: 800px applies when the screen is ___. (a) 800px or narrower (b) exactly 100px (c) 800px or wider (d) turned off
  18. 18.🎯 Which CSS selector matches this element?
    <div class="red" id="top">Hello</div>
    (a) div (b) .top (c) #red (d) span
  19. 19.True or false: JavaScript changes the text size. (a) True (b) False
  20. 20.True or false: padding is space inside the border. (a) True (b) False
  21. 21.🎯 Which CSS selector matches this element?
    <div class="box" id="intro">Hello</div>
    (a) span (b) .box (c) .intro (d) .star
  22. 22.True or false: #top is an id selector. (a) False (b) True
  23. 23.⚖️ What colour is the text of this element?
    <h2 class="big" id="logo">Hi</h2>
    CSS:
    h2 { color: orange; }
    h2 { color: white; }
    (a) white (b) orange (c) green (d) purple
  24. 24.🎯 Which sign starts an id selector? (a) . (b) # (c) @ (d) &
  25. 25.🖌️ How big is the text, in px?
    li {
      font-size: 24px;
      text-align: center;
      color: green;
      background-color: yellow;
    }
  26. 26.⚖️ What colour is the text of this element?
    <h2 class="red" id="hero">Hi</h2>
    CSS:
    .red { color: purple; }
    #hero { color: yellow; }
    h2 { color: blue; }
    (a) purple (b) orange (c) blue (d) yellow
  27. 27.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 10px;
      }
    }
  28. 28.🖌️ Which CSS property colours behind the text? (a) font-weight (b) font-family (c) color (d) background-color
  29. 29.🖌️ What colour are the letters?
    li {
      text-align: right;
      color: purple;
      background-color: red;
      font-size: 40px;
    }
    (a) red (b) green (c) purple
  30. 30.📱 What does a media query check? (a) the battery level (b) the time of day (c) the screen width (d) the page title
  31. 31.💪 Which flexbox property sets space between boxes? (a) gap (b) flex-direction (c) align-items (d) display: flex
  32. 32.🎯 Which CSS selector matches this element?
    <div class="menu" id="top">Hello</div>
    (a) div (b) .note (c) #menu (d) .top
  33. 33.🖌️ Where does the text sit on its line?
    h1 {
      background-color: green;
      font-size: 32px;
      color: yellow;
      text-align: left;
    }
    (a) in the middle (b) on the right (c) on the left
  34. 34.⚖️ What colour is the text of this element?
    <p class="star" id="logo">Hi</p>
    CSS:
    #logo { color: yellow; }
    .star { color: white; }
    p { color: purple; }
    (a) yellow (b) white (c) purple (d) orange
  35. 35.✍️ What is the selector in this CSS rule?
    .note {
      width: 300px;
      margin: 10px;
      color: red;
      background-color: yellow;
    }
    (a) 10px (b) #top (c) width (d) .note
  36. 36.✍️ What is the selector in this CSS rule?
    h2 {
      border: 2px solid;
      font-weight: bold;
    }
    (a) bold (b) h1 (c) border (d) h2
  37. 37.True or false: body is an element selector. (a) False (b) True
  38. 38.⚖️ What colour is the text of this element?
    <p class="star" id="end">Hi</p>
    CSS:
    #end { color: green; }
    .star { color: red; }
    (a) red (b) black (c) orange (d) green
  39. 39.✍️ What value is given to background-color in this rule?
    h1 {
      background-color: yellow;
      font-style: italic;
    }
    (a) 8px (b) 10px (c) yellow (d) background-color
  40. 40.🔍 Which is the odd one out? (a) shows a pop-up message (b) reacts to a button click (c) checks a quiz answer (d) adds space around boxes

Answer key

  1. white
  2. CSS
  3. .css
  4. ;
  5. in the middle
  6. :
  7. 22
  8. <h2 class="big">
  9. an element selector
  10. 224
  11. span
  12. No
  13. .note
  14. Yes
  15. 14
  16. magenta
  17. 800px or wider
  18. div
  19. False
  20. True
  21. .box
  22. True
  23. white
  24. #
  25. 24
  26. yellow
  27. 10
  28. background-color
  29. purple
  30. the screen width
  31. gap
  32. div
  33. on the left
  34. yellow
  35. .note
  36. h2
  37. True
  38. green
  39. yellow
  40. adds space around boxes

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