← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 481 · 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 attribute adds CSS inside one tag? (a) src (b) href (c) alt (d) style
  2. 2.🎨 Which tag holds CSS inside the head? (a) <body> (b) <script> (c) <css> (d) <style>
  3. 3.✍️ How does a CSS comment start? (a) // (b) <!-- (c) /* (d) #
  4. 4.✍️ Which property is set to 10px in this rule?
    body {
      font-size: 20px;
      margin: 10px;
      font-style: italic;
    }
    (a) 10px (b) margin (c) font-weight (d) padding
  5. 5.🖌️ How big is the text, in px?
    p {
      font-size: 24px;
      text-align: center;
      background-color: blue;
      color: black;
    }
  6. 6.True or false: padding is space inside the border. (a) True (b) False
  7. 7.Which of these does CSS do? (a) makes headings and lists (b) reacts to a button click (c) changes the page live (d) lays out the page
  8. 8.✍️ What value is given to font-size in this rule?
    h1 {
      font-size: 20px;
      padding: 8px;
    }
    (a) font-size (b) center (c) yellow (d) 20px
  9. 9.🌈 Which colour is #0000ff? (a) black (b) blue (c) red (d) yellow
  10. 10.✍️ CSS declarations go inside which brackets? (a) < > (b) [ ] (c) { } (d) ( )
  11. 11.🎯 What kind of selector is .big? (a) an element selector (b) a class selector (c) an id selector
  12. 12.🎯 Which element does the selector #intro style? (a) <span id="main"> (b) <span id="intro"> (c) <p class="note"> (d) <span class="intro">
  13. 13.True or false: .menu is an id selector. (a) True (b) False
  14. 14.💪 Which justify-content value equal gaps, none at ends? (a) flex-start (b) center (c) flex-end (d) space-between
  15. 15.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 340px;
      justify-content: space-between;
    }
    Inside are 4 boxes, each 40px wide (no margins).
  16. 16.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 280px;
      padding: 5px;
      border: 3px solid black;
      margin: 0px;
    }
  17. 17.⚖️ Which selector is the strongest? (a) an element selector (b) a class selector (c) an id selector
  18. 18.🔍 Which is the odd one out? (a) puts a picture on a page (b) adds space around boxes (c) makes a link (d) gives the page structure
  19. 19.Which of these does JavaScript do? (a) counts down a timer (b) gives the page structure (c) adds space around boxes (d) rounds box corners
  20. 20.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 270px;
      justify-content: flex-start;
    }
    Inside are 3 boxes, each 80px wide (no margins).
  21. 21.🖌️ Which CSS property sets the letter colour? (a) color (b) font-size (c) background-color (d) text-align
  22. 22.⚖️ 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
  23. 23.True or false: padding is the gap round content. (a) True (b) False
  24. 24.🎯 Which CSS selector matches this element?
    <h1 class="big" id="main">Hello</h1>
    (a) h2 (b) .main (c) .red (d) #main
  25. 25.📱 min-width: 800px applies when the screen is ___. (a) turned off (b) 800px or wider (c) 800px or narrower (d) exactly 100px
  26. 26.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 90px;
      padding: 30px;
      border: 4px solid black;
      margin: 20px;
    }
  27. 27.🧩 Which language changes the text size? (a) CSS (b) HTML (c) JavaScript
  28. 28.🖌️ How big is the text, in px?
    li {
      background-color: red;
      font-size: 16px;
      text-align: left;
      color: blue;
    }
  29. 29.What does font-weight do? (a) makes the text bold (b) picks the font style (c) colours behind the text (d) sets the letter colour
  30. 30.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 150px;
      justify-content: space-between;
    }
    Inside are 2 boxes, each 60px wide (no margins).
  31. 31.🎯 Can many elements share the same class? (a) Yes (b) No
  32. 32.🌈 Which colour of light is strongest in rgb(166, 47, 84)? (a) blue (b) green (c) red
  33. 33.✍️ How many declarations (property: value pairs) are in this rule?
    h1 {
      font-size: 20px;
      color: red;
    }
  34. 34.🌈 Which colour of light is strongest in rgb(210, 117, 138)? (a) green (b) blue (c) red
  35. 35.True or false: HTML lays out the page. (a) False (b) True
  36. 36.🌈 In #007500 the green part is the hex number 75. What is it as a normal number?
  37. 37.🌈 Which colour is rgb(255, 0, 255)? (a) red (b) yellow (c) magenta (d) black
  38. 38.🎯 Which CSS selector matches this element?
    <p class="big" id="end">Hello</p>
    (a) .end (b) h1 (c) .big (d) #hero
  39. 39.🧩 Which language makes headings and lists? (a) HTML (b) CSS (c) JavaScript
  40. 40.🖌️ What colour are the letters?
    h1 {
      color: yellow;
      font-size: 28px;
      text-align: right;
      background-color: orange;
    }
    (a) red (b) orange (c) yellow

Answer key

  1. style
  2. <style>
  3. /*
  4. margin
  5. 24
  6. True
  7. lays out the page
  8. 20px
  9. blue
  10. { }
  11. a class selector
  12. <span id="intro">
  13. False
  14. space-between
  15. 60
  16. 296
  17. an id selector
  18. adds space around boxes
  19. counts down a timer
  20. 30
  21. color
  22. the later one
  23. True
  24. #main
  25. 800px or wider
  26. 158
  27. CSS
  28. 16
  29. makes the text bold
  30. 30
  31. Yes
  32. red
  33. 2
  34. red
  35. False
  36. 117
  37. magenta
  38. .big
  39. HTML
  40. yellow

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