← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 190 · 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 does background-color do? (a) sets the letter colour (b) makes the text bold (c) picks the font style (d) colours behind the text
  2. 2.🖌️ What colour are the letters?
    h2 {
      background-color: orange;
      color: purple;
      font-size: 28px;
      text-align: center;
    }
    (a) purple (b) orange (c) black
  3. 3.🎯 Which sign starts an id selector? (a) @ (b) . (c) & (d) #
  4. 4.🌈 Which colour is #0000ff? (a) cyan (b) white (c) blue (d) magenta
  5. 5.🖌️ Which CSS property sets the letter colour? (a) background-color (b) color (c) font-family (d) font-weight
  6. 6.📱 Responsive design means a page ___. (a) never changes (b) has no pictures (c) is only for laptops (d) fits every screen
  7. 7.🔍 Which is the odd one out? (a) shows a pop-up message (b) changes the page live (c) puts a picture on a page (d) reacts to a button click
  8. 8.💪 Which justify-content value packs boxes at the start? (a) space-between (b) center (c) flex-start (d) flex-end
  9. 9.🌈 Which colour of light is strongest in rgb(44, 201, 33)? (a) blue (b) green (c) red
  10. 10.🎯 What kind of selector is .note? (a) an id selector (b) an element selector (c) a class selector
  11. 11.What does justify-content: flex-end do? (a) puts boxes in the middle (b) equal gaps, none at ends (c) packs boxes at the start (d) packs boxes at the end
  12. 12.🎯 Can many elements share the same class? (a) Yes (b) No
  13. 13.⚖️ What colour is the text of this element?
    <h2 class="note" id="end">Hi</h2>
    CSS:
    #end { color: black; }
    #end { color: green; }
    (a) blue (b) green (c) yellow (d) black
  14. 14.🎯 What kind of selector is #end? (a) an id selector (b) a class selector (c) an element selector
  15. 15.True or false: padding is space inside the border. (a) False (b) True
  16. 16.✍️ How does a CSS comment start? (a) <!-- (b) /* (c) // (d) #
  17. 17.🌈 In #0f0000 the red part is the hex number 0f. What is it as a normal number?
  18. 18.✍️ In color: blue; which part is the value? (a) color (b) : (c) blue (d) ;
  19. 19.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 12px;
      }
    }
  20. 20.✍️ Which property is set to 300px in this rule?
    #top {
      text-align: center;
      width: 300px;
    }
    (a) font-style (b) color (c) width (d) 300px
  21. 21.📱 What does a media query check? (a) the page title (b) the screen width (c) the time of day (d) the battery level
  22. 22.✍️ What is the selector in this CSS rule?
    #top {
      background-color: yellow;
      font-weight: bold;
      font-size: 20px;
      margin: 10px;
    }
    (a) li (b) bold (c) #top (d) background-color
  23. 23.What does font-family do? (a) makes the text bold (b) picks the font style (c) centres a heading (d) makes letters bigger
  24. 24.🎯 What kind of selector is li? (a) an element selector (b) a class selector (c) an id selector
  25. 25.Which of these is the content? (a) the gap round content (b) the text or picture (c) a solid or dotted edge (d) the line round the box
  26. 26.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 220px;
      justify-content: center;
    }
    Inside are 2 boxes, each 80px wide (no margins).
  27. 27.⚖️ What colour is the text of this element?
    <h1 class="box" id="intro">Hi</h1>
    CSS:
    #intro { color: green; }
    .box { color: purple; }
    h1 { color: blue; }
    (a) blue (b) white (c) purple (d) green
  28. 28.🎯 What kind of selector is #top? (a) a class selector (b) an element selector (c) an id selector
  29. 29.🌈 In #rrggbb, which colour do the last two digits give? (a) red (b) blue (c) white (d) green
  30. 30.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the shorter one (b) the first one (c) the later one (d) neither
  31. 31.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 10px;
      }
    }
    (a) No (b) Yes
  32. 32.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 340px;
      justify-content: center;
    }
    Inside are 4 boxes, each 60px wide (no margins).
  33. 33.True or false: CSS reacts to a button click. (a) False (b) True
  34. 34.🎯 Which CSS selector matches this element?
    <li class="note" id="top">Hello</li>
    (a) .top (b) li (c) div (d) #intro
  35. 35.What does font-weight do? (a) makes the text bold (b) colours behind the text (c) sets the letter colour (d) centres a heading
  36. 36.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 3 (b) 2 (c) 4 (d) 6
  37. 37.🌈 Which hex code is yellow? (a) #00ff00 (b) #000000 (c) #ffff00 (d) #ff00ff
  38. 38.💪 Which flexbox property spaces boxes along a row? (a) align-items (b) flex-direction (c) gap (d) justify-content
  39. 39.⚖️ What colour is the text of this element?
    <h1 class="red" id="hero">Hi</h1>
    CSS:
    #hero { color: black; }
    #hero { color: blue; }
    (a) black (b) blue (c) white (d) red
  40. 40.⚖️ What colour is the text of this element?
    <h1 class="red" id="logo">Hi</h1>
    CSS:
    #logo { color: white; }
    h1 { color: red; }
    .red { color: blue; }
    (a) blue (b) red (c) purple (d) white

Answer key

  1. colours behind the text
  2. purple
  3. #
  4. blue
  5. color
  6. fits every screen
  7. puts a picture on a page
  8. flex-start
  9. green
  10. a class selector
  11. packs boxes at the end
  12. Yes
  13. green
  14. an id selector
  15. True
  16. /*
  17. 15
  18. blue
  19. 16
  20. width
  21. the screen width
  22. #top
  23. picks the font style
  24. an element selector
  25. the text or picture
  26. 30
  27. green
  28. an id selector
  29. blue
  30. the later one
  31. Yes
  32. 50
  33. False
  34. li
  35. makes the text bold
  36. 3
  37. #ffff00
  38. justify-content
  39. blue
  40. white

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