← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 87 · 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 does font-weight do? (a) colours behind the text (b) makes letters bigger (c) makes the text bold (d) sets the letter colour
  2. 2.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 60px;
      padding: 30px;
      border: 1px solid black;
      margin: 0px;
    }
  3. 3.📱 The screen is 700px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 10px;
      }
    }
    (a) Yes (b) No
  4. 4.🎯 Which element does the selector #top style? (a) <span class="big"> (b) <div id="intro"> (c) <div class="top"> (d) <div id="top">
  5. 5.⚖️ What colour is the text of this element?
    <h2 class="box" id="logo">Hi</h2>
    CSS:
    .box { color: blue; }
    h2 { color: red; }
    #logo { color: black; }
    (a) blue (b) black (c) white (d) red
  6. 6.🔍 Which is the odd one out? (a) makes a form box (b) changes the page live (c) gives the page structure (d) puts a picture on a page
  7. 7.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 40px;
      padding: 5px;
      border: 5px solid black;
      margin: 5px;
    }
  8. 8.⚖️ Which selector is the strongest? (a) a class selector (b) an id selector (c) an element selector
  9. 9.🌈 Which colour of light is strongest in rgb(35, 92, 177)? (a) green (b) blue (c) red
  10. 10.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 180px;
      justify-content: flex-end;
    }
    Inside are 2 boxes, each 50px wide (no margins).
  11. 11.🖌️ Which CSS property colours behind the text? (a) color (b) text-align (c) background-color (d) font-family
  12. 12.✍️ Which sign ends each CSS declaration? (a) : (b) , (c) ; (d) .
  13. 13.🌈 Hex digits go 0 to 9, then A to which letter? (a) J (b) F (c) Z (d) G
  14. 14.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 22px;
      }
    }
  15. 15.📱 Which tag helps phones show a page at the right size? (a) the viewport meta tag (b) the title tag (c) the hr tag (d) the br tag
  16. 16.✍️ Which property is set to red in this rule?
    h1 {
      font-weight: bold;
      color: red;
      font-size: 20px;
      margin: 10px;
    }
    (a) red (b) font-size (c) color (d) text-align
  17. 17.📱 The screen is 414px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 26px;
      }
    }
    (a) No (b) Yes
  18. 18.⚖️ What colour is the text of this element?
    <h2 class="red" id="intro">Hi</h2>
    CSS:
    #intro { color: purple; }
    #intro { color: white; }
    (a) black (b) white (c) orange (d) purple
  19. 19.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 280px;
      padding: 5px;
      border: 2px solid black;
      margin: 5px;
    }
  20. 20.🎨 A CSS file usually ends with which extension? (a) .html (b) .js (c) .css (d) .png
  21. 21.🌈 Which colour of light is strongest in rgb(61, 69, 209)? (a) green (b) blue (c) red
  22. 22.True or false: .menu is an element selector. (a) True (b) False
  23. 23.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 28px;
      }
    }
  24. 24.⚖️ Two rules with the same selector set a colour. Which one wins? (a) neither (b) the later one (c) the first one (d) the shorter one
  25. 25.✍️ What value is given to background-color in this rule?
    body {
      background-color: yellow;
      text-align: center;
    }
    (a) yellow (b) 8px (c) 10px (d) background-color
  26. 26.🎯 Which element does the selector h2 style? (a) <span id="hero"> (b) <div class="star"> (c) <h2 class="star"> (d) <li>
  27. 27.Which of these is the border? (a) the text or picture (b) space outside the border (c) space inside the border (d) a solid or dotted edge
  28. 28.✍️ How many declarations (property: value pairs) are in this rule?
    li {
      font-size: 20px;
      padding: 8px;
      margin: 10px;
      font-weight: bold;
    }
  29. 29.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 24px;
      }
    }
    (a) Yes (b) No
  30. 30.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 250px;
      padding: 15px;
      border: 3px solid black;
      margin: 10px;
    }
  31. 31.🎯 How many elements on a page should have the same id? (a) 5 (b) 1 (c) any number (d) 2
  32. 32.🔍 Which is the odd one out? (a) lays out the page (b) sets colours and fonts (c) rounds box corners (d) puts a picture on a page
  33. 33.🌈 In #rrggbb, which colour do the last two digits give? (a) red (b) green (c) white (d) blue
  34. 34.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 60px;
      padding: 10px;
      border: 3px solid black;
      margin: 20px;
    }
  35. 35.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 140px;
      padding: 25px;
      border: 4px solid black;
      margin: 10px;
    }
  36. 36.Which of these does HTML do? (a) makes a form box (b) sets colours and fonts (c) shows a pop-up message (d) checks a quiz answer
  37. 37.🧩 Which language gives the page structure? (a) HTML (b) JavaScript (c) CSS
  38. 38.🖌️ Which CSS property sets the letter colour? (a) font-weight (b) color (c) background-color (d) font-family
  39. 39.Which of these is margin? (a) the gap to other boxes (b) a solid or dotted edge (c) space inside the border (d) the text or picture
  40. 40.🖌️ What colour are the letters?
    h2 {
      font-size: 40px;
      background-color: green;
      color: yellow;
      text-align: right;
    }
    (a) green (b) white (c) yellow

Answer key

  1. makes the text bold
  2. 122
  3. Yes
  4. <div id="top">
  5. black
  6. changes the page live
  7. 70
  8. an id selector
  9. blue
  10. 80
  11. background-color
  12. ;
  13. F
  14. 22
  15. the viewport meta tag
  16. color
  17. No
  18. white
  19. 304
  20. .css
  21. blue
  22. False
  23. 28
  24. the later one
  25. yellow
  26. <h2 class="star">
  27. a solid or dotted edge
  28. 4
  29. No
  30. 306
  31. 1
  32. puts a picture on a page
  33. blue
  34. 126
  35. 218
  36. makes a form box
  37. HTML
  38. color
  39. the gap to other boxes
  40. yellow

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