← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 734 · 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: .note is a class selector. (a) True (b) False
  2. 2.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 150px;
      padding: 30px;
      border: 3px solid black;
      margin: 0px;
    }
  3. 3.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 10px;
      }
    }
  4. 4.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 20px;
      }
    }
  5. 5.🎯 Which element does the selector #logo style? (a) <li class="logo"> (b) <li id="end"> (c) <div class="box"> (d) <li id="logo">
  6. 6.🖌️ Which CSS property picks the font style? (a) font-family (b) background-color (c) color (d) font-weight
  7. 7.🔍 Which is the odd one out? (a) changes the page live (b) makes a link (c) checks a quiz answer (d) reacts to a button click
  8. 8.🎨 What does CSS stand for? (a) Colourful Site Styles (b) Cascading Style Sheets (c) Computer Style Sheets (d) Creative Sheet System
  9. 9.📦 In the box model, which part is the gap round content? (a) margin (b) padding (c) border (d) content
  10. 10.🎯 Can many elements share the same class? (a) Yes (b) No
  11. 11.🔍 Which is the odd one out? (a) adds space around boxes (b) makes a form box (c) changes the text size (d) sets colours and fonts
  12. 12.⚖️ What colour is the text of this element?
    <p class="red" id="main">Hi</p>
    CSS:
    #main { color: white; }
    #main { color: black; }
    (a) white (b) red (c) black (d) purple
  13. 13.True or false: the content is the text or picture. (a) False (b) True
  14. 14.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 240px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 80px wide (no margins).
  15. 15.⚖️ What colour is the text of this element?
    <h2 class="red" id="top">Hi</h2>
    CSS:
    h2 { color: yellow; }
    h2 { color: purple; }
    (a) black (b) purple (c) white (d) yellow
  16. 16.✍️ What value is given to padding in this rule?
    li {
      padding: 8px;
      text-align: center;
      font-style: italic;
      border: 2px solid;
    }
    (a) padding (b) 8px (c) bold (d) 2px solid
  17. 17.🎯 Which element does the selector h1 style? (a) <h1 class="big"> (b) <h2> (c) <div id="end"> (d) <li class="big">
  18. 18.⚖️ What colour is the text of this element?
    <h1 class="note" id="top">Hi</h1>
    CSS:
    .note { color: green; }
    .note { color: purple; }
    (a) orange (b) green (c) white (d) purple
  19. 19.🎨 Which tag connects an outside CSS file? (a) <css> (b) <img> (c) <link> (d) <a>
  20. 20.🎯 What kind of selector is #end? (a) an id selector (b) an element selector (c) a class selector
  21. 21.Which of these is margin? (a) space outside the border (b) the text or picture (c) the gap round content (d) space inside the border
  22. 22.🧩 Which language changes the page live? (a) HTML (b) JavaScript (c) CSS
  23. 23.📱 Which tag helps phones show a page at the right size? (a) the br tag (b) the hr tag (c) the title tag (d) the viewport meta tag
  24. 24.🖌️ What colour are the letters?
    p {
      text-align: center;
      background-color: white;
      color: black;
      font-size: 16px;
    }
    (a) blue (b) black (c) white
  25. 25.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 340px;
      justify-content: center;
    }
    Inside are 3 boxes, each 60px wide (no margins).
  26. 26.True or false: p is an element selector. (a) True (b) False
  27. 27.True or false: the content is space outside the border. (a) False (b) True
  28. 28.🧩 Which language changes the text size? (a) JavaScript (b) HTML (c) CSS
  29. 29.🖌️ What colour is behind the letters?
    h2 {
      text-align: center;
      font-size: 36px;
      background-color: red;
      color: yellow;
    }
    (a) red (b) yellow (c) black
  30. 30.🌈 Which colour of light is strongest in rgb(107, 196, 10)? (a) green (b) blue (c) red
  31. 31.✍️ What value is given to padding in this rule?
    .note {
      padding: 8px;
      color: red;
    }
    (a) padding (b) bold (c) 8px (d) 2px solid
  32. 32.⚖️ Which selector is the weakest? (a) an element selector (b) a class selector (c) an id selector
  33. 33.Which of these is the border? (a) a solid or dotted edge (b) the gap round content (c) the text or picture (d) space outside the border
  34. 34.🎯 What kind of selector is #top? (a) a class selector (b) an id selector (c) an element selector
  35. 35.✍️ How many declarations (property: value pairs) are in this rule?
    .note {
      padding: 8px;
      font-size: 20px;
    }
  36. 36.🎯 What kind of selector is .card? (a) an id selector (b) an element selector (c) a class selector
  37. 37.📱 Responsive design means a page ___. (a) is only for laptops (b) never changes (c) fits every screen (d) has no pictures
  38. 38.True or false: .card is a class selector. (a) False (b) True
  39. 39.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 180px;
      padding: 5px;
      border: 3px solid black;
      margin: 0px;
    }
  40. 40.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 300px;
      justify-content: center;
    }
    Inside are 3 boxes, each 80px wide (no margins).

Answer key

  1. True
  2. 216
  3. 12
  4. 20
  5. <li id="logo">
  6. font-family
  7. makes a link
  8. Cascading Style Sheets
  9. padding
  10. Yes
  11. makes a form box
  12. black
  13. True
  14. 80
  15. purple
  16. 8px
  17. <h1 class="big">
  18. purple
  19. <link>
  20. an id selector
  21. space outside the border
  22. JavaScript
  23. the viewport meta tag
  24. black
  25. 80
  26. True
  27. False
  28. CSS
  29. red
  30. green
  31. 8px
  32. an element selector
  33. a solid or dotted edge
  34. an id selector
  35. 2
  36. a class selector
  37. fits every screen
  38. True
  39. 196
  40. 30

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