← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 195 · 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 540px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 14px;
      }
    }
    (a) No (b) Yes
  2. 2.🎯 What kind of selector is #hero? (a) an id selector (b) a class selector (c) an element selector
  3. 3.What does font-weight do? (a) picks the font style (b) makes letters bigger (c) colours behind the text (d) makes the text bold
  4. 4.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 100px;
      padding: 5px;
      border: 1px solid black;
      margin: 20px;
    }
  5. 5.🧩 Which language rounds box corners? (a) JavaScript (b) HTML (c) CSS
  6. 6.🖌️ Which CSS property makes the text bold? (a) color (b) font-size (c) background-color (d) font-weight
  7. 7.🌈 Which colour of light is strongest in rgb(0, 61, 178)? (a) green (b) blue (c) red
  8. 8.🎯 Which CSS selector matches this element?
    <h2 class="box" id="hero">Hello</h2>
    (a) .star (b) li (c) .hero (d) #hero
  9. 9.✍️ What is the selector in this CSS rule?
    .note {
      background-color: yellow;
      width: 300px;
    }
    (a) #top (b) 300px (c) .note (d) background-color
  10. 10.🎯 What kind of selector is .card? (a) an element selector (b) a class selector (c) an id selector
  11. 11.🌈 Which colour of light is strongest in rgb(35, 178, 135)? (a) red (b) green (c) blue
  12. 12.🖌️ What colour are the letters?
    h1 {
      text-align: left;
      font-size: 16px;
      background-color: blue;
      color: white;
    }
    (a) yellow (b) white (c) blue
  13. 13.✍️ Which sign ends each CSS declaration? (a) : (b) ; (c) , (d) .
  14. 14.📦 In the box model, which part is space outside the border? (a) margin (b) padding (c) border (d) content
  15. 15.⚖️ Which selector is the weakest? (a) an element selector (b) an id selector (c) a class selector
  16. 16.True or false: padding is the text or picture. (a) True (b) False
  17. 17.✍️ How many declarations (property: value pairs) are in this rule?
    .box {
      color: red;
      font-style: italic;
      margin: 10px;
    }
  18. 18.✍️ How many declarations (property: value pairs) are in this rule?
    h1 {
      color: red;
      font-size: 20px;
      background-color: yellow;
      text-align: center;
    }
  19. 19.📱 max-width: 600px applies when the screen is ___. (a) 600px or wider (b) 600px or narrower (c) exactly 1000px (d) turned off
  20. 20.🎯 What kind of selector is #main? (a) a class selector (b) an element selector (c) an id selector
  21. 21.🎯 Which CSS selector matches this element?
    <span class="box" id="logo">Hello</span>
    (a) p (b) .logo (c) span (d) #end
  22. 22.What does background-color do? (a) picks the font style (b) colours behind the text (c) sets the letter colour (d) makes the text bold
  23. 23.🌈 Which colour is #ffffff? (a) magenta (b) bright green (c) white (d) red
  24. 24.📱 What does a media query check? (a) the page title (b) the battery level (c) the time of day (d) the screen width
  25. 25.True or false: img is a class selector. (a) True (b) False
  26. 26.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 250px;
      padding: 20px;
      border: 5px solid black;
      margin: 0px;
    }
  27. 27.True or false: #top is an element selector. (a) True (b) False
  28. 28.⚖️ What colour is the text of this element?
    <p class="red" id="logo">Hi</p>
    CSS:
    p { color: green; }
    .red { color: red; }
    #logo { color: blue; }
    (a) black (b) red (c) green (d) blue
  29. 29.✍️ Which property is set to 2px solid in this rule?
    body {
      padding: 8px;
      width: 300px;
      border: 2px solid;
    }
    (a) border (b) 2px solid (c) width (d) font-style
  30. 30.✍️ In color: blue; which part is the value? (a) blue (b) : (c) ; (d) color
  31. 31.🎯 What kind of selector is .note? (a) an id selector (b) an element selector (c) a class selector
  32. 32.⚖️ What colour is the text of this element?
    <p class="note" id="logo">Hi</p>
    CSS:
    .note { color: white; }
    #logo { color: blue; }
    (a) yellow (b) blue (c) white (d) black
  33. 33.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 210px;
      padding: 10px;
      border: 2px solid black;
      margin: 0px;
    }
  34. 34.💪 Which justify-content value packs boxes at the start? (a) flex-end (b) center (c) space-between (d) flex-start
  35. 35.True or false: HTML lays out the page. (a) True (b) False
  36. 36.What does justify-content: space-between do? (a) packs boxes at the start (b) packs boxes at the end (c) equal gaps, none at ends (d) puts boxes in the middle
  37. 37.💪 Which justify-content value puts boxes in the middle? (a) flex-start (b) flex-end (c) center (d) space-between
  38. 38.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 170px;
      padding: 15px;
      border: 1px solid black;
      margin: 5px;
    }
  39. 39.📱 Responsive design means a page ___. (a) has no pictures (b) fits every screen (c) is only for laptops (d) never changes
  40. 40.✍️ Which property is set to 20px in this rule?
    .note {
      background-color: yellow;
      font-size: 20px;
    }
    (a) background-color (b) text-align (c) font-size (d) 20px

Answer key

  1. Yes
  2. an id selector
  3. makes the text bold
  4. 152
  5. CSS
  6. font-weight
  7. blue
  8. #hero
  9. .note
  10. a class selector
  11. green
  12. white
  13. ;
  14. margin
  15. an element selector
  16. False
  17. 3
  18. 4
  19. 600px or narrower
  20. an id selector
  21. span
  22. colours behind the text
  23. white
  24. the screen width
  25. False
  26. 300
  27. False
  28. blue
  29. border
  30. blue
  31. a class selector
  32. blue
  33. 234
  34. flex-start
  35. False
  36. equal gaps, none at ends
  37. center
  38. 202
  39. fits every screen
  40. font-size

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