← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 547 · 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 colour is the text of this element?
    <h1 class="note" id="top">Hi</h1>
    CSS:
    h1 { color: white; }
    .note { color: yellow; }
    (a) yellow (b) white (c) red (d) green
  2. 2.True or false: padding is the gap round content. (a) True (b) False
  3. 3.🌈 Which colour of light is strongest in rgb(86, 31, 238)? (a) red (b) blue (c) green
  4. 4.💪 Which flexbox property sets space between boxes? (a) align-items (b) display: flex (c) gap (d) justify-content
  5. 5.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 280px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 100px wide (no margins).
  6. 6.What does justify-content: space-between do? (a) puts boxes in the middle (b) packs boxes at the start (c) equal gaps, none at ends (d) packs boxes at the end
  7. 7.🖌️ What colour are the letters?
    h2 {
      text-align: center;
      background-color: purple;
      font-size: 20px;
      color: black;
    }
    (a) black (b) blue (c) purple
  8. 8.🔍 Which is the odd one out? (a) sets colours and fonts (b) lays out the page (c) makes a form box (d) rounds box corners
  9. 9.🔍 Which is the odd one out? (a) counts down a timer (b) reacts to a button click (c) checks a quiz answer (d) makes headings and lists
  10. 10.⚖️ Which selector is the weakest? (a) an id selector (b) an element selector (c) a class selector
  11. 11.⚖️ What colour is the text of this element?
    <h1 class="star" id="end">Hi</h1>
    CSS:
    h1 { color: yellow; }
    .star { color: white; }
    (a) orange (b) white (c) blue (d) yellow
  12. 12.✍️ Which sign goes between a property and its value? (a) ; (b) = (c) - (d) :
  13. 13.📱 Which tag helps phones show a page at the right size? (a) the viewport meta tag (b) the br tag (c) the hr tag (d) the title tag
  14. 14.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 6 (b) 3 (c) 4 (d) 2
  15. 15.🧩 Which language shows a pop-up message? (a) JavaScript (b) HTML (c) CSS
  16. 16.🎯 How many elements on a page should have the same id? (a) any number (b) 1 (c) 2 (d) 5
  17. 17.✍️ How does a CSS comment start? (a) // (b) # (c) /* (d) <!--
  18. 18.🧩 Which language makes a form box? (a) HTML (b) JavaScript (c) CSS
  19. 19.🌈 Which colour is #0000ff? (a) blue (b) yellow (c) magenta (d) black
  20. 20.⚖️ What colour is the text of this element?
    <h2 class="red" id="main">Hi</h2>
    CSS:
    .red { color: blue; }
    .red { color: black; }
    (a) yellow (b) black (c) blue (d) red
  21. 21.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 20px;
      }
    }
    (a) Yes (b) No
  22. 22.📱 What does a media query check? (a) the screen width (b) the battery level (c) the page title (d) the time of day
  23. 23.🌈 Which hex code is cyan? (a) #ffff00 (b) #ffffff (c) #00ff00 (d) #00ffff
  24. 24.✍️ In color: blue; which part is the property? (a) blue (b) : (c) color (d) ;
  25. 25.🖌️ How big is the text, in px?
    h2 {
      background-color: yellow;
      font-size: 36px;
      text-align: center;
      color: black;
    }
  26. 26.💪 Which flexbox property turns on flexbox? (a) display: flex (b) gap (c) flex-direction (d) align-items
  27. 27.🌈 What is the biggest number one colour can have in rgb()? (a) 255 (b) 99 (c) 100 (d) 1000
  28. 28.🎨 Which attribute adds CSS inside one tag? (a) href (b) alt (c) style (d) src
  29. 29.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 14px;
      }
    }
  30. 30.📦 In the box model, which part is the text or picture? (a) padding (b) margin (c) content (d) border
  31. 31.🌈 Which colour is #000000? (a) cyan (b) black (c) blue (d) white
  32. 32.✍️ What value is given to padding in this rule?
    body {
      font-weight: bold;
      padding: 8px;
    }
    (a) 2px solid (b) bold (c) 8px (d) padding
  33. 33.🖌️ Which CSS property colours behind the text? (a) font-weight (b) text-align (c) font-family (d) background-color
  34. 34.🎯 Can many elements share the same class? (a) No (b) Yes
  35. 35.🌈 In #00007c the blue part is the hex number 7c. What is it as a normal number?
  36. 36.What does font-family do? (a) picks the font style (b) sets the letter colour (c) centres a heading (d) makes letters bigger
  37. 37.What does background-color do? (a) centres a heading (b) colours behind the text (c) sets the letter colour (d) makes letters bigger
  38. 38.True or false: HTML adds space around boxes. (a) False (b) True
  39. 39.🌈 Which hex code is bright green? (a) #ff00ff (b) #0000ff (c) #00ff00 (d) #ffffff
  40. 40.🧩 Which language reacts to a button click? (a) CSS (b) JavaScript (c) HTML

Answer key

  1. yellow
  2. True
  3. blue
  4. gap
  5. 80
  6. equal gaps, none at ends
  7. black
  8. makes a form box
  9. makes headings and lists
  10. an element selector
  11. white
  12. :
  13. the viewport meta tag
  14. 3
  15. JavaScript
  16. 1
  17. /*
  18. HTML
  19. blue
  20. black
  21. Yes
  22. the screen width
  23. #00ffff
  24. color
  25. 36
  26. display: flex
  27. 255
  28. style
  29. 16
  30. content
  31. black
  32. 8px
  33. background-color
  34. Yes
  35. 124
  36. picks the font style
  37. colours behind the text
  38. False
  39. #00ff00
  40. JavaScript

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