← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 699 · 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) rounds box corners (b) changes the text size (c) makes headings and lists (d) lays out the page
  2. 2.⚖️ Which selector is the weakest? (a) a class selector (b) an id selector (c) an element selector
  3. 3.✍️ In color: blue; which part is the value? (a) blue (b) ; (c) : (d) color
  4. 4.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the later one (b) the first one (c) neither (d) the shorter one
  5. 5.🌈 What is the biggest number one colour can have in rgb()? (a) 1000 (b) 99 (c) 100 (d) 255
  6. 6.🌈 Which colour of light is strongest in rgb(1, 165, 6)? (a) green (b) red (c) blue
  7. 7.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 18px;
      }
    }
  8. 8.Which of these does JavaScript do? (a) counts down a timer (b) lays out the page (c) gives the page structure (d) makes a form box
  9. 9.🔍 Which is the odd one out? (a) shows a pop-up message (b) changes the page live (c) reacts to a button click (d) makes a form box
  10. 10.⚖️ Which selector is the strongest? (a) a class selector (b) an id selector (c) an element selector
  11. 11.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 140px;
      justify-content: space-between;
    }
    Inside are 2 boxes, each 60px wide (no margins).
  12. 12.🎯 Which CSS selector matches this element?
    <li class="star" id="top">Hello</li>
    (a) #star (b) .top (c) .menu (d) .star
  13. 13.True or false: the content is the text or picture. (a) True (b) False
  14. 14.🎨 One CSS file can style how many pages? (a) only one image (b) no pages (c) only one word (d) many pages
  15. 15.🎨 A CSS file usually ends with which extension? (a) .png (b) .css (c) .js (d) .html
  16. 16.True or false: JavaScript gives the page structure. (a) True (b) False
  17. 17.✍️ What value is given to background-color in this rule?
    .note {
      font-size: 20px;
      background-color: yellow;
      color: red;
    }
    (a) 10px (b) background-color (c) 8px (d) yellow
  18. 18.✍️ How does a CSS comment start? (a) # (b) /* (c) <!-- (d) //
  19. 19.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 130px;
      justify-content: flex-end;
    }
    Inside are 2 boxes, each 50px wide (no margins).
  20. 20.🎯 Can many elements share the same class? (a) Yes (b) No
  21. 21.🖌️ Which CSS property sets the letter colour? (a) font-size (b) text-align (c) background-color (d) color
  22. 22.🎯 What kind of selector is .card? (a) a class selector (b) an element selector (c) an id selector
  23. 23.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 120px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 50px wide (no margins).
  24. 24.💪 Which justify-content value packs boxes at the end? (a) flex-start (b) space-between (c) flex-end (d) center
  25. 25.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 300px;
      justify-content: center;
    }
    Inside are 4 boxes, each 50px wide (no margins).
  26. 26.📱 Which tag helps phones show a page at the right size? (a) the viewport meta tag (b) the hr tag (c) the br tag (d) the title tag
  27. 27.✍️ How many declarations (property: value pairs) are in this rule?
    p {
      border: 2px solid;
      width: 300px;
    }
  28. 28.🌈 Which colour is #00ffff? (a) bright green (b) black (c) cyan (d) red
  29. 29.True or false: the border is space inside the border. (a) False (b) True
  30. 30.🖌️ Which CSS property colours behind the text? (a) background-color (b) font-weight (c) text-align (d) font-family
  31. 31.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 22px;
      }
    }
  32. 32.⚖️ What colour is the text of this element?
    <h2 class="box" id="top">Hi</h2>
    CSS:
    #top { color: white; }
    #top { color: red; }
    (a) white (b) red (c) yellow (d) blue
  33. 33.📦 In the box model, which part is space inside the border? (a) content (b) margin (c) padding (d) border
  34. 34.🌈 In #rrggbb, which colour do the first two digits give? (a) red (b) black (c) green (d) blue
  35. 35.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 400px;
      justify-content: center;
    }
    Inside are 3 boxes, each 80px wide (no margins).
  36. 36.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 230px;
      justify-content: flex-end;
    }
    Inside are 3 boxes, each 50px wide (no margins).
  37. 37.True or false: #logo is an id selector. (a) False (b) True
  38. 38.💪 Which justify-content value packs boxes at the start? (a) space-between (b) flex-end (c) center (d) flex-start
  39. 39.⚖️ What colour is the text of this element?
    <h2 class="big" id="main">Hi</h2>
    CSS:
    h2 { color: orange; }
    h2 { color: green; }
    (a) black (b) red (c) orange (d) green
  40. 40.Which of these does HTML do? (a) makes a link (b) adds space around boxes (c) changes the page live (d) reacts to a button click

Answer key

  1. makes headings and lists
  2. an element selector
  3. blue
  4. the later one
  5. 255
  6. green
  7. 18
  8. counts down a timer
  9. makes a form box
  10. an id selector
  11. 20
  12. .star
  13. True
  14. many pages
  15. .css
  16. False
  17. yellow
  18. /*
  19. 30
  20. Yes
  21. color
  22. a class selector
  23. 20
  24. flex-end
  25. 50
  26. the viewport meta tag
  27. 2
  28. cyan
  29. False
  30. background-color
  31. 20
  32. red
  33. padding
  34. red
  35. 80
  36. 80
  37. True
  38. flex-start
  39. green
  40. makes a link

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