← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 973 · 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.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 280px;
      justify-content: center;
    }
    Inside are 2 boxes, each 100px wide (no margins).
  2. 2.🌈 Which colour of light is strongest in rgb(160, 138, 71)? (a) blue (b) red (c) green
  3. 3.🖌️ Where does the text sit on its line?
    h2 {
      background-color: blue;
      text-align: center;
      font-size: 36px;
      color: green;
    }
    (a) on the left (b) on the right (c) in the middle
  4. 4.🖌️ Where does the text sit on its line?
    li {
      background-color: blue;
      text-align: left;
      font-size: 28px;
      color: green;
    }
    (a) in the middle (b) on the left (c) on the right
  5. 5.⚖️ Which selector is the weakest? (a) a class selector (b) an id selector (c) an element selector
  6. 6.What does background-color do? (a) sets the letter colour (b) makes the text bold (c) colours behind the text (d) makes letters bigger
  7. 7.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 28px;
      }
    }
  8. 8.⚖️ Which selector is the strongest? (a) an id selector (b) a class selector (c) an element selector
  9. 9.📱 The screen is 820px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 22px;
      }
    }
    (a) Yes (b) No
  10. 10.🎨 A CSS file usually ends with which extension? (a) .png (b) .js (c) .html (d) .css
  11. 11.⚖️ What colour is the text of this element?
    <p class="note" id="main">Hi</p>
    CSS:
    .note { color: blue; }
    .note { color: black; }
    (a) green (b) blue (c) red (d) black
  12. 12.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 28px;
      }
    }
    (a) Yes (b) No
  13. 13.True or false: HTML makes headings and lists. (a) False (b) True
  14. 14.✍️ What value is given to background-color in this rule?
    #top {
      padding: 8px;
      background-color: yellow;
      text-align: center;
    }
    (a) 10px (b) background-color (c) yellow (d) 8px
  15. 15.🎯 Which sign starts a class selector? (a) # (b) & (c) @ (d) .
  16. 16.⚖️ What colour is the text of this element?
    <h1 class="big" id="intro">Hi</h1>
    CSS:
    h1 { color: orange; }
    h1 { color: red; }
    (a) green (b) orange (c) black (d) red
  17. 17.📱 max-width: 600px applies when the screen is ___. (a) 600px or wider (b) exactly 1000px (c) 600px or narrower (d) turned off
  18. 18.📱 What does a media query check? (a) the time of day (b) the page title (c) the screen width (d) the battery level
  19. 19.📱 The screen is 414px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 28px;
      }
    }
    (a) No (b) Yes
  20. 20.📱 Which tag helps phones show a page at the right size? (a) the title tag (b) the br tag (c) the viewport meta tag (d) the hr tag
  21. 21.✍️ What is the selector in this CSS rule?
    h2 {
      font-style: italic;
      font-weight: bold;
      text-align: center;
    }
    (a) bold (b) h2 (c) h1 (d) font-style
  22. 22.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 200px;
      justify-content: flex-start;
    }
    Inside are 3 boxes, each 60px wide (no margins).
  23. 23.📦 In the box model, which part is space outside the border? (a) content (b) padding (c) border (d) margin
  24. 24.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 2 (b) 3 (c) 6 (d) 4
  25. 25.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 16px;
      }
    }
    (a) Yes (b) No
  26. 26.Which of these does CSS do? (a) rounds box corners (b) puts a picture on a page (c) reacts to a button click (d) shows a pop-up message
  27. 27.💪 Which justify-content value equal gaps, none at ends? (a) center (b) flex-start (c) space-between (d) flex-end
  28. 28.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 18px;
      }
    }
    (a) Yes (b) No
  29. 29.🧩 Which language makes headings and lists? (a) CSS (b) HTML (c) JavaScript
  30. 30.🌈 What is the biggest number one colour can have in rgb()? (a) 100 (b) 99 (c) 255 (d) 1000
  31. 31.✍️ Which property is set to red in this rule?
    body {
      color: red;
      font-weight: bold;
      border: 2px solid;
    }
    (a) text-align (b) color (c) font-size (d) red
  32. 32.🎯 How many elements on a page should have the same id? (a) any number (b) 1 (c) 5 (d) 2
  33. 33.✍️ In color: blue; which part is the value? (a) color (b) ; (c) : (d) blue
  34. 34.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 18px;
      }
    }
  35. 35.🎯 Which element does the selector .big style? (a) <div class="box"> (b) <li id="big"> (c) <li class="red"> (d) <li class="big">
  36. 36.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 200px;
      padding: 15px;
      border: 3px solid black;
      margin: 15px;
    }
  37. 37.🎨 Which attribute adds CSS inside one tag? (a) href (b) src (c) alt (d) style
  38. 38.✍️ Which property is set to red in this rule?
    p {
      color: red;
      background-color: yellow;
    }
    (a) font-size (b) red (c) text-align (d) color
  39. 39.🖌️ How big is the text, in px?
    h2 {
      color: orange;
      font-size: 20px;
      background-color: blue;
      text-align: center;
    }
  40. 40.True or false: JavaScript reacts to a button click. (a) False (b) True

Answer key

  1. 40
  2. red
  3. in the middle
  4. on the left
  5. an element selector
  6. colours behind the text
  7. 28
  8. an id selector
  9. No
  10. .css
  11. black
  12. No
  13. True
  14. yellow
  15. .
  16. red
  17. 600px or narrower
  18. the screen width
  19. No
  20. the viewport meta tag
  21. h2
  22. 20
  23. margin
  24. 3
  25. No
  26. rounds box corners
  27. space-between
  28. Yes
  29. HTML
  30. 255
  31. color
  32. 1
  33. blue
  34. 12
  35. <li class="big">
  36. 266
  37. style
  38. color
  39. 20
  40. True

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