← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 270 · 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 CSS property colours behind the text? (a) font-family (b) font-size (c) background-color (d) font-weight
  2. 2.✍️ What value is given to text-align in this rule?
    #top {
      font-weight: bold;
      text-align: center;
    }
    (a) text-align (b) yellow (c) 10px (d) center
  3. 3.🎨 A CSS file usually ends with which extension? (a) .html (b) .png (c) .css (d) .js
  4. 4.📱 Which tag helps phones show a page at the right size? (a) the hr tag (b) the br tag (c) the title tag (d) the viewport meta tag
  5. 5.🌈 Which colour is #ff00ff? (a) white (b) cyan (c) blue (d) magenta
  6. 6.True or false: padding is the line round the box. (a) False (b) True
  7. 7.Which of these does HTML do? (a) puts a picture on a page (b) lays out the page (c) changes the page live (d) shows a pop-up message
  8. 8.🖌️ What colour are the letters?
    p {
      text-align: center;
      background-color: red;
      font-size: 12px;
      color: black;
    }
    (a) black (b) green (c) red
  9. 9.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 200px;
      padding: 20px;
      border: 1px solid black;
      margin: 10px;
    }
  10. 10.🔍 Which is the odd one out? (a) shows a pop-up message (b) changes the text size (c) adds space around boxes (d) sets colours and fonts
  11. 11.🎯 Which sign starts an id selector? (a) # (b) @ (c) . (d) &
  12. 12.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 290px;
      justify-content: center;
    }
    Inside are 3 boxes, each 50px wide (no margins).
  13. 13.📦 In the box model, which part is space inside the border? (a) content (b) padding (c) margin (d) border
  14. 14.✍️ How many declarations (property: value pairs) are in this rule?
    li {
      background-color: yellow;
      margin: 10px;
      font-weight: bold;
    }
  15. 15.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 250px;
      justify-content: flex-start;
    }
    Inside are 4 boxes, each 60px wide (no margins).
  16. 16.True or false: .note is a class selector. (a) False (b) True
  17. 17.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 220px;
      justify-content: flex-start;
    }
    Inside are 3 boxes, each 50px wide (no margins).
  18. 18.🖌️ Which CSS property makes the text bold? (a) font-family (b) background-color (c) font-weight (d) font-size
  19. 19.🔍 Which is the odd one out? (a) reacts to a button click (b) makes headings and lists (c) puts a picture on a page (d) gives the page structure
  20. 20.🎯 How many elements on a page should have the same id? (a) 1 (b) any number (c) 2 (d) 5
  21. 21.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 110px;
      padding: 30px;
      border: 5px solid black;
      margin: 15px;
    }
  22. 22.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 80px;
      padding: 10px;
      border: 2px solid black;
      margin: 15px;
    }
  23. 23.⚖️ Which selector is the weakest? (a) a class selector (b) an id selector (c) an element selector
  24. 24.🖌️ What colour is behind the letters?
    h1 {
      color: green;
      font-size: 36px;
      background-color: red;
      text-align: right;
    }
    (a) red (b) green (c) blue
  25. 25.What does background-color do? (a) makes the text bold (b) picks the font style (c) makes letters bigger (d) colours behind the text
  26. 26.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 70px;
      padding: 25px;
      border: 2px solid black;
      margin: 0px;
    }
  27. 27.🎯 What kind of selector is #main? (a) an id selector (b) a class selector (c) an element selector
  28. 28.🧩 Which language sets colours and fonts? (a) HTML (b) JavaScript (c) CSS
  29. 29.📦 In the box model, which part is the line round the box? (a) border (b) content (c) padding (d) margin
  30. 30.🎯 Which element does the selector p style? (a) <h1> (b) <h2 class="note"> (c) <p class="note"> (d) <li id="top">
  31. 31.True or false: HTML changes the text size. (a) False (b) True
  32. 32.🖌️ How big is the text, in px?
    h1 {
      color: yellow;
      text-align: center;
      font-size: 28px;
      background-color: green;
    }
  33. 33.✍️ Which property is set to italic in this rule?
    .box {
      text-align: center;
      font-style: italic;
    }
    (a) italic (b) color (c) font-style (d) font-size
  34. 34.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 110px;
      padding: 15px;
      border: 1px solid black;
      margin: 10px;
    }
  35. 35.🧩 Which language checks a quiz answer? (a) CSS (b) JavaScript (c) HTML
  36. 36.📦 In the box model, which part is the gap round content? (a) border (b) content (c) margin (d) padding
  37. 37.📱 The screen is 1366px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 8px;
      }
    }
    (a) No (b) Yes
  38. 38.🌈 What is the biggest number one colour can have in rgb()? (a) 100 (b) 255 (c) 1000 (d) 99
  39. 39.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 10px;
      }
    }
  40. 40.✍️ What is the selector in this CSS rule?
    .note {
      font-size: 20px;
      text-align: center;
    }
    (a) font-size (b) #top (c) .note (d) center

Answer key

  1. background-color
  2. center
  3. .css
  4. the viewport meta tag
  5. magenta
  6. False
  7. puts a picture on a page
  8. black
  9. 242
  10. shows a pop-up message
  11. #
  12. 70
  13. padding
  14. 3
  15. 10
  16. True
  17. 70
  18. font-weight
  19. reacts to a button click
  20. 1
  21. 210
  22. 134
  23. an element selector
  24. red
  25. colours behind the text
  26. 124
  27. an id selector
  28. CSS
  29. border
  30. <p class="note">
  31. False
  32. 28
  33. font-style
  34. 162
  35. JavaScript
  36. padding
  37. No
  38. 255
  39. 10
  40. .note

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