← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 383 · 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.True or false: #logo is an id selector. (a) False (b) True
  2. 2.⚖️ What colour is the text of this element?
    <p class="note" id="hero">Hi</p>
    CSS:
    .note { color: yellow; }
    .note { color: black; }
    (a) red (b) black (c) yellow (d) green
  3. 3.🎯 Can many elements share the same class? (a) Yes (b) No
  4. 4.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 28px;
      }
    }
  5. 5.What does justify-content: center 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
  6. 6.🎯 How many elements on a page should have the same id? (a) 5 (b) 2 (c) 1 (d) any number
  7. 7.True or false: the border is space inside the border. (a) False (b) True
  8. 8.✍️ What value is given to font-weight in this rule?
    .note {
      font-weight: bold;
      text-align: center;
    }
    (a) font-weight (b) 2px solid (c) bold (d) 300px
  9. 9.🎯 Which element does the selector #top style? (a) <span id="intro"> (b) <span class="top"> (c) <p class="box"> (d) <span id="top">
  10. 10.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 200px;
      padding: 20px;
      border: 4px solid black;
      margin: 20px;
    }
  11. 11.⚖️ Which selector is the weakest? (a) a class selector (b) an id selector (c) an element selector
  12. 12.💪 Which flexbox property sets space between boxes? (a) flex-direction (b) align-items (c) display: flex (d) gap
  13. 13.🎯 Which sign starts a class selector? (a) . (b) & (c) @ (d) #
  14. 14.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 10px;
      }
    }
  15. 15.⚖️ What colour is the text of this element?
    <p class="star" id="top">Hi</p>
    CSS:
    p { color: blue; }
    p { color: orange; }
    (a) red (b) black (c) orange (d) blue
  16. 16.⚖️ What colour is the text of this element?
    <h1 class="note" id="intro">Hi</h1>
    CSS:
    h1 { color: purple; }
    #intro { color: orange; }
    .note { color: red; }
    (a) red (b) purple (c) orange (d) yellow
  17. 17.True or false: #end is an element selector. (a) True (b) False
  18. 18.🎯 Which CSS selector matches this element?
    <div class="big" id="intro">Hello</div>
    (a) .red (b) #big (c) div (d) #main
  19. 19.True or false: img is an element selector. (a) True (b) False
  20. 20.True or false: .menu is an element selector. (a) False (b) True
  21. 21.What does font-weight do? (a) picks the font style (b) makes the text bold (c) makes letters bigger (d) sets the letter colour
  22. 22.📱 What does a media query check? (a) the battery level (b) the screen width (c) the page title (d) the time of day
  23. 23.⚖️ What colour is the text of this element?
    <h1 class="big" id="hero">Hi</h1>
    CSS:
    #hero { color: yellow; }
    h1 { color: black; }
    (a) white (b) yellow (c) black (d) red
  24. 24.⚖️ What colour is the text of this element?
    <p class="box" id="end">Hi</p>
    CSS:
    .box { color: purple; }
    .box { color: red; }
    (a) green (b) purple (c) red (d) blue
  25. 25.🎨 One CSS file can style how many pages? (a) only one word (b) only one image (c) no pages (d) many pages
  26. 26.🖌️ Which CSS property colours behind the text? (a) font-size (b) font-family (c) background-color (d) text-align
  27. 27.🖌️ How big is the text, in px?
    p {
      color: black;
      text-align: center;
      font-size: 24px;
      background-color: red;
    }
  28. 28.📱 Responsive design means a page ___. (a) never changes (b) fits every screen (c) has no pictures (d) is only for laptops
  29. 29.📦 In the box model, which part is a solid or dotted edge? (a) content (b) margin (c) border (d) padding
  30. 30.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 190px;
      padding: 25px;
      border: 4px solid black;
      margin: 5px;
    }
  31. 31.✍️ In color: blue; which part is the value? (a) : (b) color (c) blue (d) ;
  32. 32.🌈 Hex digits go 0 to 9, then A to which letter? (a) J (b) G (c) Z (d) F
  33. 33.🌈 Which colour is #00ff00? (a) magenta (b) black (c) blue (d) bright green
  34. 34.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 130px;
      padding: 10px;
      border: 1px solid black;
      margin: 15px;
    }
  35. 35.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 10px;
      }
    }
    (a) Yes (b) No
  36. 36.✍️ CSS declarations go inside which brackets? (a) [ ] (b) ( ) (c) { } (d) < >
  37. 37.✍️ Which property is set to 2px solid in this rule?
    .note {
      border: 2px solid;
      font-size: 20px;
      background-color: yellow;
    }
    (a) width (b) border (c) font-style (d) 2px solid
  38. 38.🖌️ What colour are the letters?
    li {
      color: green;
      text-align: center;
      font-size: 36px;
      background-color: blue;
    }
    (a) blue (b) green (c) orange
  39. 39.🌈 Which colour is rgb(255, 255, 255)? (a) black (b) magenta (c) blue (d) white
  40. 40.⚖️ What colour is the text of this element?
    <p class="menu" id="top">Hi</p>
    CSS:
    p { color: green; }
    #top { color: black; }
    (a) black (b) green (c) red (d) yellow

Answer key

  1. True
  2. black
  3. Yes
  4. 28
  5. puts boxes in the middle
  6. 1
  7. False
  8. bold
  9. <span id="top">
  10. 288
  11. an element selector
  12. gap
  13. .
  14. 12
  15. orange
  16. orange
  17. False
  18. div
  19. True
  20. False
  21. makes the text bold
  22. the screen width
  23. yellow
  24. red
  25. many pages
  26. background-color
  27. 24
  28. fits every screen
  29. border
  30. 248
  31. blue
  32. F
  33. bright green
  34. 152
  35. Yes
  36. { }
  37. border
  38. green
  39. white
  40. black

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