← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 364 · 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 property is set to italic in this rule?
    #top {
      font-style: italic;
      font-weight: bold;
      text-align: center;
    }
    (a) italic (b) font-style (c) color (d) font-size
  2. 2.Which of these does HTML do? (a) lays out the page (b) checks a quiz answer (c) rounds box corners (d) makes a form box
  3. 3.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 110px;
      padding: 5px;
      border: 5px solid black;
      margin: 10px;
    }
  4. 4.🎯 Which CSS selector matches this element?
    <li class="menu" id="hero">Hello</li>
    (a) .hero (b) #menu (c) .menu (d) #top
  5. 5.✍️ How many declarations (property: value pairs) are in this rule?
    h2 {
      margin: 10px;
      font-weight: bold;
    }
  6. 6.🖌️ Where does the text sit on its line?
    h1 {
      color: purple;
      background-color: green;
      text-align: left;
      font-size: 16px;
    }
    (a) on the right (b) on the left (c) in the middle
  7. 7.🎯 What kind of selector is .big? (a) an id selector (b) a class selector (c) an element selector
  8. 8.🖌️ Where does the text sit on its line?
    h2 {
      font-size: 12px;
      color: blue;
      text-align: left;
      background-color: white;
    }
    (a) on the left (b) on the right (c) in the middle
  9. 9.🎯 Which element does the selector h2 style? (a) <span id="hero"> (b) <li> (c) <div class="red"> (d) <h2 class="red">
  10. 10.✍️ What value is given to width in this rule?
    .note {
      padding: 8px;
      width: 300px;
    }
    (a) 300px (b) width (c) italic (d) red
  11. 11.🖌️ What colour is behind the letters?
    h1 {
      color: yellow;
      font-size: 40px;
      text-align: center;
      background-color: white;
    }
    (a) yellow (b) red (c) white
  12. 12.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 400px;
      justify-content: center;
    }
    Inside are 3 boxes, each 80px wide (no margins).
  13. 13.📦 In the box model, which part is the gap to other boxes? (a) content (b) padding (c) border (d) margin
  14. 14.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 20px;
      }
    }
  15. 15.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 8px;
      }
    }
  16. 16.🎯 Which sign starts a class selector? (a) . (b) & (c) # (d) @
  17. 17.🖌️ How big is the text, in px?
    h1 {
      color: black;
      background-color: blue;
      text-align: left;
      font-size: 16px;
    }
  18. 18.📱 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;
      }
    }
  19. 19.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 20px;
      }
    }
  20. 20.⚖️ What colour is the text of this element?
    <h1 class="note" id="logo">Hi</h1>
    CSS:
    #logo { color: red; }
    #logo { color: black; }
    (a) red (b) black (c) purple (d) blue
  21. 21.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 22px;
      }
    }
    (a) Yes (b) No
  22. 22.⚖️ Which selector is the strongest? (a) an id selector (b) an element selector (c) a class selector
  23. 23.🌈 In #rrggbb, which colour do the first two digits give? (a) blue (b) green (c) black (d) red
  24. 24.🎯 Can many elements share the same class? (a) No (b) Yes
  25. 25.🖌️ What colour are the letters?
    li {
      text-align: right;
      font-size: 36px;
      background-color: yellow;
      color: white;
    }
    (a) yellow (b) black (c) white
  26. 26.✍️ How many declarations (property: value pairs) are in this rule?
    .note {
      width: 300px;
      color: red;
      border: 2px solid;
      font-weight: bold;
    }
  27. 27.🎯 Which CSS selector matches this element?
    <li class="star" id="intro">Hello</li>
    (a) .menu (b) #star (c) .intro (d) #intro
  28. 28.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 28px;
      }
    }
  29. 29.🧩 Which language puts a picture on a page? (a) HTML (b) JavaScript (c) CSS
  30. 30.✍️ How many declarations (property: value pairs) are in this rule?
    h2 {
      color: red;
      font-size: 20px;
    }
  31. 31.🎯 Which element does the selector span style? (a) <h1 class="box"> (b) <span class="box"> (c) <p> (d) <h2 id="end">
  32. 32.Which of these is the content? (a) space inside the border (b) space outside the border (c) the text or picture (d) a solid or dotted edge
  33. 33.✍️ CSS declarations go inside which brackets? (a) < > (b) ( ) (c) { } (d) [ ]
  34. 34.📦 In the box model, which part is a solid or dotted edge? (a) border (b) padding (c) margin (d) content
  35. 35.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 22px;
      }
    }
  36. 36.📱 What does a media query check? (a) the battery level (b) the screen width (c) the page title (d) the time of day
  37. 37.🎯 Which CSS selector matches this element?
    <span class="note" id="logo">Hello</span>
    (a) .big (b) #end (c) #logo (d) p
  38. 38.🌈 Which colour of light is strongest in rgb(243, 33, 75)? (a) red (b) green (c) blue
  39. 39.Which of these does JavaScript do? (a) makes headings and lists (b) makes a link (c) changes the page live (d) lays out the page
  40. 40.🌈 Which colour of light is strongest in rgb(59, 8, 191)? (a) red (b) blue (c) green

Answer key

  1. font-style
  2. makes a form box
  3. 150
  4. .menu
  5. 2
  6. on the left
  7. a class selector
  8. on the left
  9. <h2 class="red">
  10. 300px
  11. white
  12. 80
  13. margin
  14. 16
  15. 12
  16. .
  17. 16
  18. 16
  19. 12
  20. black
  21. No
  22. an id selector
  23. red
  24. Yes
  25. white
  26. 4
  27. #intro
  28. 28
  29. HTML
  30. 2
  31. <span class="box">
  32. the text or picture
  33. { }
  34. border
  35. 22
  36. the screen width
  37. #logo
  38. red
  39. changes the page live
  40. blue

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