← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 815 · 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.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the first one (b) neither (c) the shorter one (d) the later one
  2. 2.⚖️ What colour is the text of this element?
    <h2 class="star" id="end">Hi</h2>
    CSS:
    #end { color: purple; }
    #end { color: red; }
    (a) yellow (b) orange (c) purple (d) red
  3. 3.💪 Which justify-content value packs boxes at the start? (a) flex-start (b) space-between (c) flex-end (d) center
  4. 4.📱 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
  5. 5.🖌️ Which CSS property colours behind the text? (a) background-color (b) font-family (c) color (d) text-align
  6. 6.🎯 Which CSS selector matches this element?
    <h1 class="red" id="main">Hello</h1>
    (a) #logo (b) .main (c) .red (d) #red
  7. 7.True or false: JavaScript makes a form box. (a) True (b) False
  8. 8.🎯 Which CSS selector matches this element?
    <span class="big" id="end">Hello</span>
    (a) .end (b) p (c) #end (d) .red
  9. 9.🧩 Which language sets colours and fonts? (a) CSS (b) HTML (c) JavaScript
  10. 10.🎯 Which element does the selector h2 style? (a) <li> (b) <h2 class="menu"> (c) <div class="menu"> (d) <span id="main">
  11. 11.🧩 Which language makes headings and lists? (a) HTML (b) CSS (c) JavaScript
  12. 12.🎯 Which sign starts a class selector? (a) & (b) # (c) . (d) @
  13. 13.🖌️ Which CSS property picks the font style? (a) text-align (b) font-family (c) background-color (d) color
  14. 14.🖌️ Where does the text sit on its line?
    p {
      text-align: center;
      font-size: 20px;
      color: red;
      background-color: white;
    }
    (a) in the middle (b) on the left (c) on the right
  15. 15.True or false: the content is a solid or dotted edge. (a) True (b) False
  16. 16.🌈 Which colour is #0000ff? (a) cyan (b) red (c) blue (d) bright green
  17. 17.🌈 Which hex code is yellow? (a) #0000ff (b) #00ffff (c) #ffff00 (d) #ff0000
  18. 18.💪 Which justify-content value packs boxes at the end? (a) center (b) flex-start (c) flex-end (d) space-between
  19. 19.📱 max-width: 600px applies when the screen is ___. (a) turned off (b) 600px or wider (c) exactly 1000px (d) 600px or narrower
  20. 20.✍️ Which sign goes between a property and its value? (a) ; (b) - (c) = (d) :
  21. 21.What does text-align do? (a) sets the letter colour (b) colours behind the text (c) picks the font style (d) centres a heading
  22. 22.⚖️ What colour is the text of this element?
    <h2 class="big" id="end">Hi</h2>
    CSS:
    .big { color: red; }
    h2 { color: blue; }
    (a) red (b) blue (c) black (d) green
  23. 23.⚖️ What colour is the text of this element?
    <h2 class="red" id="logo">Hi</h2>
    CSS:
    #logo { color: green; }
    h2 { color: blue; }
    .red { color: black; }
    (a) blue (b) green (c) black (d) white
  24. 24.Which of these does HTML do? (a) reacts to a button click (b) lays out the page (c) rounds box corners (d) makes headings and lists
  25. 25.⚖️ Which selector is the strongest? (a) an element selector (b) a class selector (c) an id selector
  26. 26.🖌️ Which CSS property makes letters bigger? (a) font-family (b) font-size (c) color (d) background-color
  27. 27.True or false: padding is space inside the border. (a) False (b) True
  28. 28.Which of these does CSS do? (a) gives the page structure (b) shows a pop-up message (c) makes headings and lists (d) adds space around boxes
  29. 29.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 3 (b) 6 (c) 2 (d) 4
  30. 30.⚖️ What colour is the text of this element?
    <h1 class="box" id="main">Hi</h1>
    CSS:
    #main { color: orange; }
    h1 { color: black; }
    .box { color: blue; }
    (a) green (b) orange (c) blue (d) black
  31. 31.Which of these does JavaScript do? (a) shows a pop-up message (b) makes a link (c) makes headings and lists (d) puts a picture on a page
  32. 32.✍️ What is the selector in this CSS rule?
    .note {
      width: 300px;
      font-style: italic;
      font-size: 20px;
      padding: 8px;
    }
    (a) italic (b) .note (c) #top (d) width
  33. 33.🖌️ What colour is behind the letters?
    li {
      text-align: right;
      color: blue;
      font-size: 12px;
      background-color: purple;
    }
    (a) black (b) purple (c) blue
  34. 34.🎯 Which CSS selector matches this element?
    <h2 class="box" id="top">Hello</h2>
    (a) #box (b) .top (c) .star (d) h2
  35. 35.📱 The screen is 1100px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 24px;
      }
    }
    (a) Yes (b) No
  36. 36.💪 Which flexbox property picks row or column? (a) justify-content (b) flex-direction (c) display: flex (d) gap
  37. 37.True or false: the content is space outside the border. (a) True (b) False
  38. 38.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 14px;
      }
    }
    (a) No (b) Yes
  39. 39.What does color do? (a) sets the letter colour (b) makes the text bold (c) picks the font style (d) makes letters bigger
  40. 40.🖌️ What colour are the letters?
    li {
      color: black;
      font-size: 32px;
      background-color: purple;
      text-align: center;
    }
    (a) black (b) purple (c) orange

Answer key

  1. the later one
  2. red
  3. flex-start
  4. the viewport meta tag
  5. background-color
  6. .red
  7. False
  8. #end
  9. CSS
  10. <h2 class="menu">
  11. HTML
  12. .
  13. font-family
  14. in the middle
  15. False
  16. blue
  17. #ffff00
  18. flex-end
  19. 600px or narrower
  20. :
  21. centres a heading
  22. red
  23. green
  24. makes headings and lists
  25. an id selector
  26. font-size
  27. True
  28. adds space around boxes
  29. 3
  30. orange
  31. shows a pop-up message
  32. .note
  33. purple
  34. h2
  35. Yes
  36. flex-direction
  37. False
  38. No
  39. sets the letter colour
  40. black

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