← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 554 · 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 language sets colours and fonts? (a) JavaScript (b) HTML (c) CSS
  2. 2.🌈 Which colour is rgb(255, 0, 0)? (a) black (b) red (c) bright green (d) blue
  3. 3.🖌️ How big is the text, in px?
    h1 {
      font-size: 24px;
      text-align: right;
      color: blue;
      background-color: black;
    }
  4. 4.🎯 Which CSS selector matches this element?
    <span class="note" id="end">Hello</span>
    (a) p (b) span (c) #note (d) .big
  5. 5.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 18px;
      }
    }
  6. 6.🖌️ What colour is behind the letters?
    p {
      text-align: right;
      background-color: green;
      font-size: 32px;
      color: orange;
    }
    (a) black (b) orange (c) green
  7. 7.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 180px;
      padding: 10px;
      border: 5px solid black;
      margin: 15px;
    }
  8. 8.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 140px;
      justify-content: space-between;
    }
    Inside are 2 boxes, each 40px wide (no margins).
  9. 9.🎯 Which sign starts a class selector? (a) . (b) & (c) @ (d) #
  10. 10.🖌️ What colour is behind the letters?
    h2 {
      background-color: black;
      color: blue;
      font-size: 36px;
      text-align: center;
    }
    (a) black (b) blue (c) green
  11. 11.🌈 Which colour of light is strongest in rgb(206, 110, 47)? (a) red (b) blue (c) green
  12. 12.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 450px;
      justify-content: space-between;
    }
    Inside are 4 boxes, each 60px wide (no margins).
  13. 13.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 14px;
      }
    }
  14. 14.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 22px;
      }
    }
  15. 15.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 100px;
      padding: 30px;
      border: 2px solid black;
      margin: 0px;
    }
  16. 16.Which of these is the border? (a) a solid or dotted edge (b) the gap round content (c) the text or picture (d) the gap to other boxes
  17. 17.⚖️ Which selector is the strongest? (a) an element selector (b) an id selector (c) a class selector
  18. 18.🧩 Which language puts a picture on a page? (a) HTML (b) JavaScript (c) CSS
  19. 19.📱 max-width: 600px applies when the screen is ___. (a) exactly 1000px (b) 600px or wider (c) 600px or narrower (d) turned off
  20. 20.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 440px;
      justify-content: center;
    }
    Inside are 4 boxes, each 80px wide (no margins).
  21. 21.True or false: body is an id selector. (a) False (b) True
  22. 22.🎯 Which element does the selector .big style? (a) <h1 class="red"> (b) <h2 class="box"> (c) <h1 id="big"> (d) <h1 class="big">
  23. 23.True or false: HTML gives the page structure. (a) True (b) False
  24. 24.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 300px;
      justify-content: space-between;
    }
    Inside are 4 boxes, each 60px wide (no margins).
  25. 25.What does justify-content: flex-end do? (a) puts boxes in the middle (b) packs boxes at the start (c) equal gaps, none at ends (d) packs boxes at the end
  26. 26.⚖️ What colour is the text of this element?
    <h1 class="menu" id="top">Hi</h1>
    CSS:
    .menu { color: red; }
    h1 { color: blue; }
    (a) orange (b) yellow (c) blue (d) red
  27. 27.⚖️ Which selector is the weakest? (a) an element selector (b) an id selector (c) a class selector
  28. 28.💪 Which flexbox property turns on flexbox? (a) align-items (b) flex-direction (c) display: flex (d) justify-content
  29. 29.What does justify-content: flex-start do? (a) packs boxes at the end (b) packs boxes at the start (c) equal gaps, none at ends (d) puts boxes in the middle
  30. 30.📱 Which tag helps phones show a page at the right size? (a) the br tag (b) the hr tag (c) the viewport meta tag (d) the title tag
  31. 31.⚖️ What colour is the text of this element?
    <p class="menu" id="main">Hi</p>
    CSS:
    p { color: red; }
    #main { color: purple; }
    (a) orange (b) blue (c) purple (d) red
  32. 32.📦 In the box model, which part is the gap round content? (a) content (b) border (c) margin (d) padding
  33. 33.🖌️ What colour are the letters?
    p {
      font-size: 16px;
      background-color: red;
      text-align: right;
      color: orange;
    }
    (a) orange (b) white (c) red
  34. 34.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 260px;
      justify-content: center;
    }
    Inside are 2 boxes, each 50px wide (no margins).
  35. 35.📱 min-width: 800px applies when the screen is ___. (a) 800px or narrower (b) exactly 100px (c) turned off (d) 800px or wider
  36. 36.⚖️ What colour is the text of this element?
    <p class="big" id="hero">Hi</p>
    CSS:
    #hero { color: yellow; }
    p { color: purple; }
    .big { color: blue; }
    (a) blue (b) white (c) yellow (d) purple
  37. 37.⚖️ What colour is the text of this element?
    <p class="star" id="logo">Hi</p>
    CSS:
    .star { color: white; }
    #logo { color: black; }
    (a) black (b) white (c) orange (d) blue
  38. 38.What does font-weight do? (a) makes the text bold (b) sets the letter colour (c) makes letters bigger (d) centres a heading
  39. 39.⚖️ What colour is the text of this element?
    <p class="box" id="main">Hi</p>
    CSS:
    #main { color: yellow; }
    .box { color: blue; }
    p { color: green; }
    (a) green (b) blue (c) yellow (d) white
  40. 40.📱 Responsive design means a page ___. (a) has no pictures (b) is only for laptops (c) never changes (d) fits every screen

Answer key

  1. CSS
  2. red
  3. 24
  4. span
  5. 16
  6. green
  7. 240
  8. 60
  9. .
  10. black
  11. red
  12. 70
  13. 14
  14. 16
  15. 164
  16. a solid or dotted edge
  17. an id selector
  18. HTML
  19. 600px or narrower
  20. 60
  21. False
  22. <h1 class="big">
  23. True
  24. 20
  25. packs boxes at the end
  26. red
  27. an element selector
  28. display: flex
  29. packs boxes at the start
  30. the viewport meta tag
  31. purple
  32. padding
  33. orange
  34. 80
  35. 800px or wider
  36. yellow
  37. black
  38. makes the text bold
  39. yellow
  40. fits every screen

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