← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 928 · 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.What does background-color do? (a) makes the text bold (b) centres a heading (c) colours behind the text (d) picks the font style
  2. 2.⚖️ What colour is the text of this element?
    <h2 class="red" id="main">Hi</h2>
    CSS:
    h2 { color: orange; }
    h2 { color: red; }
    (a) red (b) purple (c) blue (d) orange
  3. 3.🖌️ What colour are the letters?
    p {
      text-align: right;
      color: purple;
      font-size: 20px;
      background-color: orange;
    }
    (a) orange (b) purple (c) black
  4. 4.✍️ Which property is set to 300px in this rule?
    .note {
      width: 300px;
      font-style: italic;
    }
    (a) font-style (b) color (c) 300px (d) width
  5. 5.🧩 Which language sets colours and fonts? (a) HTML (b) JavaScript (c) CSS
  6. 6.🔍 Which is the odd one out? (a) makes a form box (b) puts a picture on a page (c) makes headings and lists (d) adds space around boxes
  7. 7.🌈 Which colour is #00ffff? (a) magenta (b) yellow (c) cyan (d) white
  8. 8.⚖️ Which selector is the weakest? (a) a class selector (b) an element selector (c) an id selector
  9. 9.📱 Which tag helps phones show a page at the right size? (a) the title tag (b) the hr tag (c) the viewport meta tag (d) the br tag
  10. 10.📱 max-width: 600px applies when the screen is ___. (a) 600px or wider (b) exactly 1000px (c) turned off (d) 600px or narrower
  11. 11.🎯 What kind of selector is #logo? (a) a class selector (b) an id selector (c) an element selector
  12. 12.What does text-align do? (a) centres a heading (b) makes the text bold (c) sets the letter colour (d) picks the font style
  13. 13.True or false: CSS sets colours and fonts. (a) True (b) False
  14. 14.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 230px;
      justify-content: flex-start;
    }
    Inside are 4 boxes, each 50px wide (no margins).
  15. 15.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 10px;
      }
    }
  16. 16.📱 The screen is 1366px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 24px;
      }
    }
    (a) Yes (b) No
  17. 17.🎯 Which element does the selector #end style? (a) <div class="box"> (b) <li id="end"> (c) <li class="end"> (d) <li id="hero">
  18. 18.True or false: the content is the text or picture. (a) False (b) True
  19. 19.✍️ What is the selector in this CSS rule?
    p {
      padding: 8px;
      width: 300px;
      text-align: center;
      font-style: italic;
    }
    (a) .note (b) padding (c) 300px (d) p
  20. 20.🎯 What kind of selector is .note? (a) an id selector (b) a class selector (c) an element selector
  21. 21.📱 min-width: 800px applies when the screen is ___. (a) 800px or narrower (b) exactly 100px (c) turned off (d) 800px or wider
  22. 22.🔍 Which is the odd one out? (a) changes the text size (b) puts a picture on a page (c) gives the page structure (d) makes headings and lists
  23. 23.🌈 Which hex code is yellow? (a) #ff00ff (b) #00ffff (c) #0000ff (d) #ffff00
  24. 24.✍️ Which property is set to center in this rule?
    .box {
      text-align: center;
      font-style: italic;
      color: red;
      font-size: 20px;
    }
    (a) center (b) background-color (c) margin (d) text-align
  25. 25.✍️ In color: blue; which part is the value? (a) : (b) blue (c) color (d) ;
  26. 26.True or false: .star is an element selector. (a) False (b) True
  27. 27.📱 The screen is 1366px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 10px;
      }
    }
    (a) No (b) Yes
  28. 28.🎯 Which sign starts an id selector? (a) & (b) @ (c) . (d) #
  29. 29.💪 Which flexbox property turns on flexbox? (a) gap (b) align-items (c) display: flex (d) justify-content
  30. 30.🖌️ Which CSS property makes letters bigger? (a) text-align (b) font-family (c) font-size (d) background-color
  31. 31.💪 Which justify-content value packs boxes at the start? (a) flex-end (b) space-between (c) center (d) flex-start
  32. 32.Which of these does CSS do? (a) makes a link (b) adds space around boxes (c) gives the page structure (d) checks a quiz answer
  33. 33.🖌️ Where does the text sit on its line?
    h2 {
      font-size: 32px;
      text-align: right;
      background-color: red;
      color: purple;
    }
    (a) on the right (b) on the left (c) in the middle
  34. 34.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 8px;
      }
    }
  35. 35.🧩 Which language makes headings and lists? (a) CSS (b) JavaScript (c) HTML
  36. 36.💪 Which justify-content value packs boxes at the end? (a) flex-end (b) flex-start (c) space-between (d) center
  37. 37.⚖️ Which selector is the strongest? (a) an id selector (b) an element selector (c) a class selector
  38. 38.🔍 Which is the odd one out? (a) adds space around boxes (b) changes the text size (c) rounds box corners (d) reacts to a button click
  39. 39.What does font-family do? (a) sets the letter colour (b) centres a heading (c) picks the font style (d) makes letters bigger
  40. 40.🎯 What kind of selector is #top? (a) an element selector (b) a class selector (c) an id selector

Answer key

  1. colours behind the text
  2. red
  3. purple
  4. width
  5. CSS
  6. adds space around boxes
  7. cyan
  8. an element selector
  9. the viewport meta tag
  10. 600px or narrower
  11. an id selector
  12. centres a heading
  13. True
  14. 30
  15. 16
  16. Yes
  17. <li id="end">
  18. True
  19. p
  20. a class selector
  21. 800px or wider
  22. changes the text size
  23. #ffff00
  24. text-align
  25. blue
  26. False
  27. No
  28. #
  29. display: flex
  30. font-size
  31. flex-start
  32. adds space around boxes
  33. on the right
  34. 12
  35. HTML
  36. flex-end
  37. an id selector
  38. reacts to a button click
  39. picks the font style
  40. an id selector

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