← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 703 · 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 is the odd one out? (a) reacts to a button click (b) counts down a timer (c) lays out the page (d) changes the page live
  2. 2.🌈 Hex digits go 0 to 9, then A to which letter? (a) G (b) Z (c) F (d) J
  3. 3.🎯 What kind of selector is .menu? (a) a class selector (b) an element selector (c) an id selector
  4. 4.🔍 Which is the odd one out? (a) sets colours and fonts (b) gives the page structure (c) makes a form box (d) makes a link
  5. 5.🎯 Which CSS selector matches this element?
    <div class="note" id="end">Hello</div>
    (a) .note (b) #note (c) span (d) .end
  6. 6.🔍 Which is the odd one out? (a) gives the page structure (b) adds space around boxes (c) rounds box corners (d) lays out the page
  7. 7.🖌️ What colour are the letters?
    li {
      text-align: right;
      color: purple;
      background-color: green;
      font-size: 20px;
    }
    (a) green (b) purple (c) white
  8. 8.📦 In the box model, which part is space outside the border? (a) padding (b) margin (c) content (d) border
  9. 9.✍️ Which property is set to 10px in this rule?
    .note {
      color: red;
      margin: 10px;
      text-align: center;
      font-size: 20px;
    }
    (a) font-weight (b) padding (c) 10px (d) margin
  10. 10.🌈 Which colour is rgb(0, 255, 0)? (a) blue (b) bright green (c) black (d) red
  11. 11.🎯 Which CSS selector matches this element?
    <h1 class="big" id="hero">Hello</h1>
    (a) h2 (b) .hero (c) .big (d) .red
  12. 12.🎯 Which CSS selector matches this element?
    <span class="red" id="logo">Hello</span>
    (a) .logo (b) p (c) span (d) #red
  13. 13.🧩 Which language rounds box corners? (a) HTML (b) CSS (c) JavaScript
  14. 14.✍️ Which sign goes between a property and its value? (a) ; (b) = (c) : (d) -
  15. 15.📱 The screen is 700px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 14px;
      }
    }
    (a) Yes (b) No
  16. 16.🌈 Which colour is rgb(255, 0, 0)? (a) magenta (b) red (c) yellow (d) blue
  17. 17.💪 Which flexbox property lines boxes up across? (a) justify-content (b) gap (c) flex-direction (d) align-items
  18. 18.📱 What does a media query check? (a) the time of day (b) the battery level (c) the screen width (d) the page title
  19. 19.Which of these does JavaScript do? (a) puts a picture on a page (b) shows a pop-up message (c) sets colours and fonts (d) makes a link
  20. 20.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 18px;
      }
    }
  21. 21.✍️ What is the selector in this CSS rule?
    h2 {
      font-style: italic;
      border: 2px solid;
      padding: 8px;
    }
    (a) h2 (b) h1 (c) font-style (d) 2px solid
  22. 22.⚖️ Which selector is the weakest? (a) an id selector (b) a class selector (c) an element selector
  23. 23.⚖️ What colour is the text of this element?
    <h2 class="menu" id="end">Hi</h2>
    CSS:
    h2 { color: white; }
    h2 { color: blue; }
    (a) green (b) blue (c) white (d) purple
  24. 24.✍️ Which property is set to 2px solid in this rule?
    li {
      font-weight: bold;
      color: red;
      border: 2px solid;
    }
    (a) border (b) font-style (c) width (d) 2px solid
  25. 25.🔍 Which is the odd one out? (a) shows a pop-up message (b) gives the page structure (c) makes a link (d) makes a form box
  26. 26.What does justify-content: flex-start do? (a) equal gaps, none at ends (b) puts boxes in the middle (c) packs boxes at the start (d) packs boxes at the end
  27. 27.📱 max-width: 600px applies when the screen is ___. (a) 600px or wider (b) 600px or narrower (c) turned off (d) exactly 1000px
  28. 28.True or false: the content is a solid or dotted edge. (a) True (b) False
  29. 29.✍️ CSS declarations go inside which brackets? (a) { } (b) ( ) (c) [ ] (d) < >
  30. 30.True or false: JavaScript counts down a timer. (a) False (b) True
  31. 31.🌈 In #d80000 the red part is the hex number d8. What is it as a normal number?
  32. 32.🎨 Which tag holds CSS inside the head? (a) <css> (b) <script> (c) <style> (d) <body>
  33. 33.🖌️ How big is the text, in px?
    p {
      background-color: purple;
      text-align: left;
      color: black;
      font-size: 24px;
    }
  34. 34.🎯 Can many elements share the same class? (a) Yes (b) No
  35. 35.True or false: img is a class selector. (a) True (b) False
  36. 36.🌈 Which colour of light is strongest in rgb(139, 161, 12)? (a) blue (b) red (c) green
  37. 37.What does font-family do? (a) picks the font style (b) sets the letter colour (c) centres a heading (d) makes the text bold
  38. 38.📦 In the box model, which part is space inside the border? (a) border (b) content (c) padding (d) margin
  39. 39.⚖️ 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
  40. 40.Which of these does CSS do? (a) makes a form box (b) reacts to a button click (c) sets colours and fonts (d) shows a pop-up message

Answer key

  1. lays out the page
  2. F
  3. a class selector
  4. sets colours and fonts
  5. .note
  6. gives the page structure
  7. purple
  8. margin
  9. margin
  10. bright green
  11. .big
  12. span
  13. CSS
  14. :
  15. No
  16. red
  17. align-items
  18. the screen width
  19. shows a pop-up message
  20. 16
  21. h2
  22. an element selector
  23. blue
  24. border
  25. shows a pop-up message
  26. packs boxes at the start
  27. 600px or narrower
  28. False
  29. { }
  30. True
  31. 216
  32. <style>
  33. 24
  34. Yes
  35. False
  36. green
  37. picks the font style
  38. padding
  39. the later one
  40. sets colours and fonts

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