← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 324 · 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.🖌️ Where does the text sit on its line?
    h1 {
      text-align: center;
      color: yellow;
      background-color: black;
      font-size: 36px;
    }
    (a) on the left (b) in the middle (c) on the right
  2. 2.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 110px;
      padding: 15px;
      border: 4px solid black;
      margin: 15px;
    }
  3. 3.✍️ Which sign ends each CSS declaration? (a) : (b) . (c) ; (d) ,
  4. 4.Which of these is the content? (a) space inside the border (b) the gap round content (c) the text or picture (d) a solid or dotted edge
  5. 5.💪 Which justify-content value puts boxes in the middle? (a) center (b) space-between (c) flex-end (d) flex-start
  6. 6.🌈 Which colour is #0000ff? (a) black (b) magenta (c) bright green (d) blue
  7. 7.🔍 Which is the odd one out? (a) makes a form box (b) puts a picture on a page (c) gives the page structure (d) changes the text size
  8. 8.✍️ CSS declarations go inside which brackets? (a) ( ) (b) { } (c) [ ] (d) < >
  9. 9.📱 The screen is 540px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 20px;
      }
    }
    (a) No (b) Yes
  10. 10.🎯 Which CSS selector matches this element?
    <p class="star" id="top">Hello</p>
    (a) #intro (b) .star (c) h1 (d) #star
  11. 11.Which of these does HTML do? (a) counts down a timer (b) reacts to a button click (c) gives the page structure (d) lays out the page
  12. 12.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 150px;
      justify-content: space-between;
    }
    Inside are 2 boxes, each 60px wide (no margins).
  13. 13.🌈 In #rrggbb, which colour do the first two digits give? (a) red (b) blue (c) green (d) black
  14. 14.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 120px;
      padding: 30px;
      border: 5px solid black;
      margin: 15px;
    }
  15. 15.⚖️ Which selector is the weakest? (a) an element selector (b) a class selector (c) an id selector
  16. 16.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 280px;
      padding: 5px;
      border: 5px solid black;
      margin: 0px;
    }
  17. 17.Which of these is padding? (a) the gap to other boxes (b) the text or picture (c) space inside the border (d) a solid or dotted edge
  18. 18.🎨 Which attribute adds CSS inside one tag? (a) src (b) alt (c) style (d) href
  19. 19.True or false: .card is a class selector. (a) False (b) True
  20. 20.🖌️ Which CSS property colours behind the text? (a) font-weight (b) background-color (c) font-size (d) color
  21. 21.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 110px;
      padding: 25px;
      border: 1px solid black;
      margin: 0px;
    }
  22. 22.🌈 What is the biggest number one colour can have in rgb()? (a) 1000 (b) 255 (c) 100 (d) 99
  23. 23.🖌️ Which CSS property centres a heading? (a) font-family (b) text-align (c) font-size (d) background-color
  24. 24.🧩 Which language changes the page live? (a) JavaScript (b) CSS (c) HTML
  25. 25.Which of these does HTML do? (a) checks a quiz answer (b) rounds box corners (c) makes a form box (d) changes the text size
  26. 26.True or false: #hero is an element selector. (a) True (b) False
  27. 27.🎯 What kind of selector is #hero? (a) a class selector (b) an element selector (c) an id selector
  28. 28.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 16px;
      }
    }
    (a) Yes (b) No
  29. 29.True or false: #logo is an element selector. (a) True (b) False
  30. 30.🖌️ What colour are the letters?
    li {
      color: orange;
      background-color: yellow;
      font-size: 24px;
      text-align: right;
    }
    (a) purple (b) orange (c) yellow
  31. 31.✍️ What is the selector in this CSS rule?
    h2 {
      border: 2px solid;
      font-weight: bold;
      text-align: center;
    }
    (a) h2 (b) border (c) h1 (d) bold
  32. 32.🖌️ What colour is behind the letters?
    p {
      color: orange;
      text-align: center;
      font-size: 40px;
      background-color: white;
    }
    (a) orange (b) blue (c) white
  33. 33.🖌️ What colour is behind the letters?
    h1 {
      background-color: green;
      text-align: left;
      font-size: 24px;
      color: yellow;
    }
    (a) green (b) yellow (c) black
  34. 34.✍️ What is the selector in this CSS rule?
    h1 {
      background-color: yellow;
      color: red;
      text-align: center;
    }
    (a) red (b) h1 (c) p (d) background-color
  35. 35.What does font-family do? (a) picks the font style (b) sets the letter colour (c) colours behind the text (d) makes the text bold
  36. 36.🧩 Which language lays out the page? (a) HTML (b) CSS (c) JavaScript
  37. 37.🖌️ Which CSS property makes the text bold? (a) text-align (b) font-weight (c) font-size (d) background-color
  38. 38.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 26px;
      }
    }
  39. 39.What does color do? (a) colours behind the text (b) sets the letter colour (c) centres a heading (d) picks the font style
  40. 40.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 100px;
      padding: 20px;
      border: 3px solid black;
      margin: 10px;
    }

Answer key

  1. in the middle
  2. 178
  3. ;
  4. the text or picture
  5. center
  6. blue
  7. changes the text size
  8. { }
  9. No
  10. .star
  11. gives the page structure
  12. 30
  13. red
  14. 190
  15. an element selector
  16. 300
  17. space inside the border
  18. style
  19. True
  20. background-color
  21. 162
  22. 255
  23. text-align
  24. JavaScript
  25. makes a form box
  26. False
  27. an id selector
  28. Yes
  29. False
  30. orange
  31. h2
  32. white
  33. green
  34. h1
  35. picks the font style
  36. CSS
  37. font-weight
  38. 26
  39. sets the letter colour
  40. 146

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