← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 860 · 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.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 20px;
      }
    }
  2. 2.🧩 Which language reacts to a button click? (a) HTML (b) CSS (c) JavaScript
  3. 3.Which of these does JavaScript do? (a) puts a picture on a page (b) sets colours and fonts (c) gives the page structure (d) shows a pop-up message
  4. 4.🖌️ Which CSS property sets the letter colour? (a) font-size (b) text-align (c) color (d) font-family
  5. 5.🌈 Hex digits go 0 to 9, then A to which letter? (a) Z (b) F (c) J (d) G
  6. 6.📱 The screen is 1366px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 6px;
      }
    }
    (a) Yes (b) No
  7. 7.⚖️ What colour is the text of this element?
    <p class="menu" id="intro">Hi</p>
    CSS:
    .menu { color: blue; }
    .menu { color: orange; }
    (a) orange (b) blue (c) red (d) green
  8. 8.🖌️ What colour are the letters?
    p {
      background-color: yellow;
      font-size: 28px;
      text-align: center;
      color: red;
    }
    (a) yellow (b) red (c) white
  9. 9.🎯 How many elements on a page should have the same id? (a) 1 (b) 2 (c) 5 (d) any number
  10. 10.📱 Which tag helps phones show a page at the right size? (a) the viewport meta tag (b) the br tag (c) the title tag (d) the hr tag
  11. 11.📱 max-width: 600px applies when the screen is ___. (a) 600px or narrower (b) 600px or wider (c) exactly 1000px (d) turned off
  12. 12.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 210px;
      padding: 25px;
      border: 3px solid black;
      margin: 20px;
    }
  13. 13.🎯 Which sign starts an id selector? (a) @ (b) & (c) . (d) #
  14. 14.🖌️ Which CSS property makes the text bold? (a) font-family (b) background-color (c) font-size (d) font-weight
  15. 15.🌈 Which colour of light is strongest in rgb(204, 24, 59)? (a) red (b) green (c) blue
  16. 16.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 360px;
      justify-content: center;
    }
    Inside are 4 boxes, each 50px wide (no margins).
  17. 17.📱 Responsive design means a page ___. (a) is only for laptops (b) never changes (c) fits every screen (d) has no pictures
  18. 18.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 18px;
      }
    }
  19. 19.⚖️ What colour is the text of this element?
    <h2 class="menu" id="end">Hi</h2>
    CSS:
    h2 { color: yellow; }
    h2 { color: green; }
    (a) yellow (b) orange (c) blue (d) green
  20. 20.🌈 Which hex code is white? (a) #00ff00 (b) #ff0000 (c) #ffff00 (d) #ffffff
  21. 21.⚖️ What colour is the text of this element?
    <p class="star" id="intro">Hi</p>
    CSS:
    p { color: yellow; }
    p { color: red; }
    (a) purple (b) yellow (c) red (d) blue
  22. 22.🎯 Which element does the selector #top style? (a) <h1 id="top"> (b) <h1 class="top"> (c) <h2 class="menu"> (d) <h1 id="intro">
  23. 23.📱 The screen is 1366px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 14px;
      }
    }
    (a) No (b) Yes
  24. 24.Which of these is margin? (a) the text or picture (b) the line round the box (c) a solid or dotted edge (d) the gap to other boxes
  25. 25.🌈 Which hex code is blue? (a) #ff0000 (b) #ffffff (c) #0000ff (d) #00ffff
  26. 26.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 170px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 60px wide (no margins).
  27. 27.🖌️ What colour is behind the letters?
    li {
      text-align: center;
      color: blue;
      background-color: yellow;
      font-size: 36px;
    }
    (a) yellow (b) blue (c) white
  28. 28.⚖️ What colour is the text of this element?
    <p class="menu" id="top">Hi</p>
    CSS:
    #top { color: orange; }
    .menu { color: purple; }
    p { color: red; }
    (a) orange (b) red (c) white (d) purple
  29. 29.📱 The screen is 414px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 14px;
      }
    }
    (a) Yes (b) No
  30. 30.🔍 Which is the odd one out? (a) changes the page live (b) reacts to a button click (c) lays out the page (d) counts down a timer
  31. 31.🎯 What kind of selector is .star? (a) an id selector (b) an element selector (c) a class selector
  32. 32.💪 Which flexbox property picks row or column? (a) display: flex (b) flex-direction (c) align-items (d) gap
  33. 33.🌈 Which colour is rgb(0, 0, 0)? (a) white (b) red (c) yellow (d) black
  34. 34.🎯 Which element does the selector #intro style? (a) <div id="intro"> (b) <div id="main"> (c) <div class="intro"> (d) <span class="menu">
  35. 35.🎯 What kind of selector is #top? (a) an id selector (b) a class selector (c) an element selector
  36. 36.🎯 What kind of selector is #end? (a) a class selector (b) an element selector (c) an id selector
  37. 37.✍️ In color: blue; which part is the property? (a) ; (b) color (c) : (d) blue
  38. 38.📦 In the box model, which part is space outside the border? (a) border (b) content (c) margin (d) padding
  39. 39.🔍 Which is the odd one out? (a) rounds box corners (b) changes the text size (c) sets colours and fonts (d) gives the page structure
  40. 40.✍️ What is the selector in this CSS rule?
    h1 {
      color: red;
      margin: 10px;
      text-align: center;
      border: 2px solid;
    }
    (a) h1 (b) 10px (c) p (d) color

Answer key

  1. 20
  2. JavaScript
  3. shows a pop-up message
  4. color
  5. F
  6. No
  7. orange
  8. red
  9. 1
  10. the viewport meta tag
  11. 600px or narrower
  12. 266
  13. #
  14. font-weight
  15. red
  16. 80
  17. fits every screen
  18. 24
  19. green
  20. #ffffff
  21. red
  22. <h1 id="top">
  23. Yes
  24. the gap to other boxes
  25. #0000ff
  26. 50
  27. yellow
  28. orange
  29. Yes
  30. lays out the page
  31. a class selector
  32. flex-direction
  33. black
  34. <div id="intro">
  35. an id selector
  36. an id selector
  37. color
  38. margin
  39. gives the page structure
  40. h1

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