← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 733 · 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 of these does HTML do? (a) makes a link (b) lays out the page (c) changes the page live (d) sets colours and fonts
  2. 2.🌈 In #rrggbb, which colour do the last two digits give? (a) green (b) red (c) white (d) blue
  3. 3.📦 In the box model, which part is the gap round content? (a) content (b) margin (c) border (d) padding
  4. 4.📦 In the box model, which part is the text or picture? (a) content (b) border (c) margin (d) padding
  5. 5.🌈 Which colour is #ff00ff? (a) magenta (b) black (c) yellow (d) cyan
  6. 6.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 6px;
      }
    }
  7. 7.🌈 Which hex code is black? (a) #00ffff (b) #000000 (c) #ffffff (d) #ff0000
  8. 8.💪 Which justify-content value equal gaps, none at ends? (a) center (b) flex-end (c) space-between (d) flex-start
  9. 9.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 220px;
      justify-content: flex-start;
    }
    Inside are 3 boxes, each 50px wide (no margins).
  10. 10.🎯 Which element does the selector p style? (a) <h2 class="note"> (b) <h1> (c) <p class="note"> (d) <li id="intro">
  11. 11.🌈 Which colour of light is strongest in rgb(187, 10, 54)? (a) red (b) green (c) blue
  12. 12.✍️ Which property is set to yellow in this rule?
    h1 {
      border: 2px solid;
      color: red;
      background-color: yellow;
    }
    (a) background-color (b) margin (c) yellow (d) padding
  13. 13.✍️ Which sign goes between a property and its value? (a) : (b) ; (c) = (d) -
  14. 14.✍️ Which property is set to 8px in this rule?
    h1 {
      font-style: italic;
      text-align: center;
      padding: 8px;
      margin: 10px;
    }
    (a) border (b) font-weight (c) 8px (d) padding
  15. 15.🌈 Which colour is rgb(0, 255, 0)? (a) white (b) bright green (c) blue (d) magenta
  16. 16.📱 Which tag helps phones show a page at the right size? (a) the br tag (b) the viewport meta tag (c) the title tag (d) the hr tag
  17. 17.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 28px;
      }
    }
  18. 18.True or false: the border is space outside the border. (a) True (b) False
  19. 19.🖌️ Which CSS property sets the letter colour? (a) font-weight (b) color (c) font-family (d) text-align
  20. 20.🎯 Which element does the selector div style? (a) <h1 id="logo"> (b) <div class="menu"> (c) <p class="menu"> (d) <span>
  21. 21.🧩 Which language changes the text size? (a) CSS (b) HTML (c) JavaScript
  22. 22.✍️ What is the selector in this CSS rule?
    li {
      width: 300px;
      color: red;
      margin: 10px;
    }
    (a) red (b) width (c) body (d) li
  23. 23.⚖️ What colour is the text of this element?
    <h2 class="star" id="end">Hi</h2>
    CSS:
    #end { color: black; }
    h2 { color: red; }
    .star { color: purple; }
    (a) red (b) green (c) black (d) purple
  24. 24.✍️ What is the selector in this CSS rule?
    li {
      text-align: center;
      font-style: italic;
      padding: 8px;
    }
    (a) text-align (b) italic (c) li (d) body
  25. 25.What does justify-content: center do? (a) packs boxes at the start (b) equal gaps, none at ends (c) packs boxes at the end (d) puts boxes in the middle
  26. 26.⚖️ What colour is the text of this element?
    <h2 class="big" id="main">Hi</h2>
    CSS:
    h2 { color: white; }
    h2 { color: purple; }
    (a) purple (b) white (c) black (d) orange
  27. 27.🖌️ How big is the text, in px?
    h2 {
      font-size: 28px;
      background-color: yellow;
      text-align: left;
      color: blue;
    }
  28. 28.🎯 Which element does the selector h2 style? (a) <li> (b) <h2 class="menu"> (c) <span id="top"> (d) <div class="menu">
  29. 29.What does justify-content: flex-end do? (a) packs boxes at the end (b) puts boxes in the middle (c) packs boxes at the start (d) equal gaps, none at ends
  30. 30.True or false: JavaScript reacts to a button click. (a) False (b) True
  31. 31.🔍 Which is the odd one out? (a) makes a form box (b) checks a quiz answer (c) puts a picture on a page (d) makes a link
  32. 32.🌈 Which colour is #ffffff? (a) yellow (b) blue (c) black (d) white
  33. 33.📱 Responsive design means a page ___. (a) never changes (b) is only for laptops (c) fits every screen (d) has no pictures
  34. 34.📱 The screen is 1100px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 8px;
      }
    }
    (a) Yes (b) No
  35. 35.⚖️ What colour is the text of this element?
    <h2 class="big" id="top">Hi</h2>
    CSS:
    #top { color: purple; }
    h2 { color: white; }
    (a) yellow (b) white (c) orange (d) purple
  36. 36.💪 Which flexbox property lines boxes up across? (a) display: flex (b) justify-content (c) gap (d) align-items
  37. 37.🌈 Which colour of light is strongest in rgb(43, 186, 14)? (a) red (b) blue (c) green
  38. 38.⚖️ What colour is the text of this element?
    <p class="menu" id="top">Hi</p>
    CSS:
    p { color: white; }
    p { color: blue; }
    (a) white (b) black (c) blue (d) red
  39. 39.🌈 What is the biggest number one colour can have in rgb()? (a) 100 (b) 255 (c) 99 (d) 1000
  40. 40.🌈 Which colour of light is strongest in rgb(77, 131, 222)? (a) blue (b) green (c) red

Answer key

  1. makes a link
  2. blue
  3. padding
  4. content
  5. magenta
  6. 12
  7. #000000
  8. space-between
  9. 70
  10. <p class="note">
  11. red
  12. background-color
  13. :
  14. padding
  15. bright green
  16. the viewport meta tag
  17. 24
  18. False
  19. color
  20. <div class="menu">
  21. CSS
  22. li
  23. black
  24. li
  25. puts boxes in the middle
  26. purple
  27. 28
  28. <h2 class="menu">
  29. packs boxes at the end
  30. True
  31. checks a quiz answer
  32. white
  33. fits every screen
  34. No
  35. purple
  36. align-items
  37. green
  38. blue
  39. 255
  40. blue

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