← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 967 · 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 value is given to background-color in this rule?
    h1 {
      background-color: yellow;
      font-style: italic;
    }
    (a) yellow (b) background-color (c) 8px (d) 10px
  2. 2.✍️ CSS declarations go inside which brackets? (a) ( ) (b) { } (c) [ ] (d) < >
  3. 3.True or false: JavaScript counts down a timer. (a) True (b) False
  4. 4.🔍 Which is the odd one out? (a) lays out the page (b) adds space around boxes (c) makes a link (d) sets colours and fonts
  5. 5.🎯 What kind of selector is .note? (a) an id selector (b) an element selector (c) a class selector
  6. 6.🖌️ Where does the text sit on its line?
    li {
      color: orange;
      text-align: right;
      background-color: green;
      font-size: 16px;
    }
    (a) in the middle (b) on the left (c) on the right
  7. 7.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 60px;
      padding: 15px;
      border: 4px solid black;
      margin: 5px;
    }
  8. 8.⚖️ What colour is the text of this element?
    <p class="red" id="main">Hi</p>
    CSS:
    p { color: red; }
    p { color: yellow; }
    (a) red (b) yellow (c) orange (d) purple
  9. 9.🧩 Which language sets colours and fonts? (a) CSS (b) HTML (c) JavaScript
  10. 10.🖌️ Where does the text sit on its line?
    h2 {
      font-size: 24px;
      background-color: green;
      text-align: center;
      color: white;
    }
    (a) on the left (b) in the middle (c) on the right
  11. 11.🎯 Which element does the selector #top style? (a) <li id="top"> (b) <div class="menu"> (c) <li class="top"> (d) <li id="intro">
  12. 12.🖌️ Which CSS property picks the font style? (a) font-family (b) background-color (c) text-align (d) color
  13. 13.True or false: the border is a solid or dotted edge. (a) True (b) False
  14. 14.🖌️ Where does the text sit on its line?
    p {
      text-align: right;
      color: blue;
      font-size: 40px;
      background-color: orange;
    }
    (a) in the middle (b) on the left (c) on the right
  15. 15.✍️ Which property is set to center in this rule?
    h2 {
      text-align: center;
      color: red;
    }
    (a) margin (b) text-align (c) background-color (d) center
  16. 16.📦 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: 5px;
      border: 5px solid black;
      margin: 10px;
    }
  17. 17.⚖️ Which selector is the weakest? (a) an element selector (b) a class selector (c) an id selector
  18. 18.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 180px;
      padding: 15px;
      border: 2px solid black;
      margin: 10px;
    }
  19. 19.True or false: margin is the gap to other boxes. (a) True (b) False
  20. 20.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 230px;
      padding: 10px;
      border: 3px solid black;
      margin: 10px;
    }
  21. 21.What does justify-content: flex-end do? (a) puts boxes in the middle (b) packs boxes at the end (c) equal gaps, none at ends (d) packs boxes at the start
  22. 22.📱 The screen is 540px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 20px;
      }
    }
    (a) Yes (b) No
  23. 23.🖌️ Where does the text sit on its line?
    h1 {
      font-size: 20px;
      text-align: right;
      color: blue;
      background-color: orange;
    }
    (a) in the middle (b) on the right (c) on the left
  24. 24.🎨 Which attribute adds CSS inside one tag? (a) alt (b) src (c) style (d) href
  25. 25.🧩 Which language makes a form box? (a) HTML (b) JavaScript (c) CSS
  26. 26.📱 Responsive design means a page ___. (a) has no pictures (b) never changes (c) is only for laptops (d) fits every screen
  27. 27.🎯 Which element does the selector .star style? (a) <li id="star"> (b) <li class="star"> (c) <div class="note"> (d) <li class="menu">
  28. 28.Which of these is the border? (a) space outside the border (b) the gap to other boxes (c) the gap round content (d) a solid or dotted edge
  29. 29.✍️ What value is given to border in this rule?
    body {
      border: 2px solid;
      margin: 10px;
    }
    (a) italic (b) 2px solid (c) 300px (d) border
  30. 30.🖌️ What colour are the letters?
    p {
      text-align: left;
      background-color: orange;
      font-size: 32px;
      color: green;
    }
    (a) green (b) white (c) orange
  31. 31.✍️ How does a CSS comment start? (a) /* (b) // (c) # (d) <!--
  32. 32.🎨 One CSS file can style how many pages? (a) only one image (b) only one word (c) no pages (d) many pages
  33. 33.🖌️ Where does the text sit on its line?
    h2 {
      background-color: orange;
      font-size: 16px;
      text-align: left;
      color: purple;
    }
    (a) on the left (b) on the right (c) in the middle
  34. 34.🖌️ What colour is behind the letters?
    p {
      text-align: right;
      color: orange;
      background-color: blue;
      font-size: 24px;
    }
    (a) white (b) blue (c) orange
  35. 35.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 200px;
      padding: 15px;
      border: 1px solid black;
      margin: 5px;
    }
  36. 36.🖌️ Where does the text sit on its line?
    h1 {
      background-color: red;
      text-align: center;
      font-size: 32px;
      color: green;
    }
    (a) in the middle (b) on the left (c) on the right
  37. 37.🖌️ How big is the text, in px?
    h1 {
      font-size: 40px;
      text-align: center;
      color: red;
      background-color: white;
    }
  38. 38.⚖️ What colour is the text of this element?
    <h2 class="box" id="logo">Hi</h2>
    CSS:
    #logo { color: blue; }
    #logo { color: yellow; }
    (a) orange (b) white (c) blue (d) yellow
  39. 39.✍️ In color: blue; which part is the property? (a) : (b) blue (c) color (d) ;
  40. 40.🖌️ Which CSS property makes letters bigger? (a) color (b) background-color (c) font-weight (d) font-size

Answer key

  1. yellow
  2. { }
  3. True
  4. makes a link
  5. a class selector
  6. on the right
  7. 108
  8. yellow
  9. CSS
  10. in the middle
  11. <li id="top">
  12. font-family
  13. True
  14. on the right
  15. text-align
  16. 190
  17. an element selector
  18. 234
  19. True
  20. 276
  21. packs boxes at the end
  22. Yes
  23. on the right
  24. style
  25. HTML
  26. fits every screen
  27. <li class="star">
  28. a solid or dotted edge
  29. 2px solid
  30. green
  31. /*
  32. many pages
  33. on the left
  34. blue
  35. 242
  36. in the middle
  37. 40
  38. yellow
  39. color
  40. font-size

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