← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 690 · 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 tag connects an outside CSS file? (a) <a> (b) <css> (c) <link> (d) <img>
  2. 2.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 18px;
      }
    }
    (a) No (b) Yes
  3. 3.📱 Responsive design means a page ___. (a) fits every screen (b) never changes (c) is only for laptops (d) has no pictures
  4. 4.📦 In the box model, which part is the text or picture? (a) border (b) padding (c) margin (d) content
  5. 5.📱 The screen is 540px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 14px;
      }
    }
    (a) No (b) Yes
  6. 6.💪 Which flexbox property turns on flexbox? (a) display: flex (b) justify-content (c) gap (d) align-items
  7. 7.✍️ How many declarations (property: value pairs) are in this rule?
    h1 {
      padding: 8px;
      text-align: center;
    }
  8. 8.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the first one (b) the shorter one (c) neither (d) the later one
  9. 9.📱 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;
      }
    }
  10. 10.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 240px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 80px wide (no margins).
  11. 11.⚖️ What colour is the text of this element?
    <h2 class="box" id="main">Hi</h2>
    CSS:
    h2 { color: yellow; }
    #main { color: black; }
    .box { color: green; }
    (a) purple (b) yellow (c) green (d) black
  12. 12.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 14px;
      }
    }
  13. 13.True or false: .menu is a class selector. (a) True (b) False
  14. 14.⚖️ What colour is the text of this element?
    <p class="note" id="end">Hi</p>
    CSS:
    #end { color: purple; }
    .note { color: black; }
    (a) blue (b) red (c) purple (d) black
  15. 15.✍️ What value is given to border in this rule?
    li {
      border: 2px solid;
      font-weight: bold;
      background-color: yellow;
    }
    (a) 300px (b) 2px solid (c) italic (d) border
  16. 16.🎯 Which CSS selector matches this element?
    <p class="note" id="end">Hello</p>
    (a) #end (b) .end (c) .big (d) #hero
  17. 17.✍️ What value is given to margin in this rule?
    li {
      text-align: center;
      font-weight: bold;
      margin: 10px;
    }
    (a) 10px (b) margin (c) 8px (d) bold
  18. 18.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 190px;
      justify-content: flex-end;
    }
    Inside are 2 boxes, each 80px wide (no margins).
  19. 19.True or false: HTML gives the page structure. (a) True (b) False
  20. 20.What does font-size do? (a) makes the text bold (b) sets the letter colour (c) colours behind the text (d) makes letters bigger
  21. 21.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 380px;
      justify-content: center;
    }
    Inside are 3 boxes, each 80px wide (no margins).
  22. 22.True or false: p is an id selector. (a) True (b) False
  23. 23.💪 Which flexbox property spaces boxes along a row? (a) gap (b) flex-direction (c) display: flex (d) justify-content
  24. 24.True or false: #top is an id selector. (a) True (b) False
  25. 25.🔍 Which is the odd one out? (a) makes a link (b) rounds box corners (c) puts a picture on a page (d) makes a form box
  26. 26.🎯 What kind of selector is h1? (a) an id selector (b) an element selector (c) a class selector
  27. 27.🎯 What kind of selector is body? (a) an element selector (b) an id selector (c) a class selector
  28. 28.🎯 Which CSS selector matches this element?
    <li class="note" id="main">Hello</li>
    (a) #logo (b) div (c) li (d) .big
  29. 29.🎯 What kind of selector is .big? (a) a class selector (b) an id selector (c) an element selector
  30. 30.🌈 In #rrggbb, which colour do the first two digits give? (a) green (b) black (c) blue (d) red
  31. 31.Which of these does JavaScript do? (a) shows a pop-up message (b) changes the text size (c) makes a link (d) makes headings and lists
  32. 32.🧩 Which language makes a link? (a) CSS (b) HTML (c) JavaScript
  33. 33.⚖️ What colour is the text of this element?
    <h1 class="note" id="hero">Hi</h1>
    CSS:
    #hero { color: purple; }
    h1 { color: orange; }
    (a) orange (b) red (c) yellow (d) purple
  34. 34.📱 min-width: 800px applies when the screen is ___. (a) 800px or narrower (b) turned off (c) 800px or wider (d) exactly 100px
  35. 35.📦 In the box model, which part is space outside the border? (a) margin (b) content (c) padding (d) border
  36. 36.True or false: JavaScript puts a picture on a page. (a) False (b) True
  37. 37.What does font-family do? (a) sets the letter colour (b) picks the font style (c) colours behind the text (d) makes the text bold
  38. 38.✍️ What is the selector in this CSS rule?
    body {
      font-weight: bold;
      margin: 10px;
    }
    (a) .box (b) body (c) font-weight (d) 10px
  39. 39.🌈 Which colour is #0000ff? (a) bright green (b) blue (c) red (d) yellow
  40. 40.🖌️ Which CSS property picks the font style? (a) font-family (b) font-size (c) font-weight (d) color

Answer key

  1. <link>
  2. Yes
  3. fits every screen
  4. content
  5. No
  6. display: flex
  7. 2
  8. the later one
  9. 16
  10. 80
  11. black
  12. 14
  13. True
  14. purple
  15. 2px solid
  16. #end
  17. 10px
  18. 30
  19. True
  20. makes letters bigger
  21. 70
  22. False
  23. justify-content
  24. True
  25. rounds box corners
  26. an element selector
  27. an element selector
  28. li
  29. a class selector
  30. red
  31. shows a pop-up message
  32. HTML
  33. purple
  34. 800px or wider
  35. margin
  36. False
  37. picks the font style
  38. body
  39. blue
  40. font-family

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