← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 46 · 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.True or false: CSS changes the page live. (a) True (b) False
  2. 2.⚖️ Two rules with the same selector set a colour. Which one wins? (a) neither (b) the first one (c) the shorter one (d) the later one
  3. 3.✍️ Which sign goes between a property and its value? (a) - (b) ; (c) : (d) =
  4. 4.🌈 Which colour is rgb(0, 255, 0)? (a) blue (b) yellow (c) cyan (d) bright green
  5. 5.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 560px;
      justify-content: space-between;
    }
    Inside are 4 boxes, each 80px wide (no margins).
  6. 6.💪 Which justify-content value packs boxes at the end? (a) space-between (b) center (c) flex-end (d) flex-start
  7. 7.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 480px;
      justify-content: flex-end;
    }
    Inside are 4 boxes, each 100px wide (no margins).
  8. 8.🧩 Which language changes the text size? (a) CSS (b) HTML (c) JavaScript
  9. 9.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 440px;
      justify-content: space-between;
    }
    Inside are 4 boxes, each 50px wide (no margins).
  10. 10.🎯 Which CSS selector matches this element?
    <div class="star" id="top">Hello</div>
    (a) .menu (b) .star (c) .top (d) #star
  11. 11.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 14px;
      }
    }
  12. 12.🔍 Which is the odd one out? (a) shows a pop-up message (b) reacts to a button click (c) changes the page live (d) adds space around boxes
  13. 13.⚖️ What colour is the text of this element?
    <h1 class="red" id="intro">Hi</h1>
    CSS:
    .red { color: white; }
    .red { color: orange; }
    (a) orange (b) blue (c) white (d) yellow
  14. 14.🎯 Which sign starts an id selector? (a) @ (b) # (c) & (d) .
  15. 15.True or false: padding is space inside the border. (a) False (b) True
  16. 16.🎯 Which CSS selector matches this element?
    <h1 class="red" id="top">Hello</h1>
    (a) #intro (b) .box (c) h1 (d) h2
  17. 17.✍️ What value is given to border in this rule?
    #top {
      font-size: 20px;
      border: 2px solid;
      font-weight: bold;
    }
    (a) 2px solid (b) 300px (c) italic (d) border
  18. 18.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 440px;
      justify-content: center;
    }
    Inside are 4 boxes, each 80px wide (no margins).
  19. 19.🌈 Which hex code is magenta? (a) #0000ff (b) #ffffff (c) #ff00ff (d) #00ffff
  20. 20.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 18px;
      }
    }
    (a) No (b) Yes
  21. 21.✍️ How many declarations (property: value pairs) are in this rule?
    p {
      background-color: yellow;
      font-style: italic;
    }
  22. 22.🎯 Which CSS selector matches this element?
    <span class="box" id="intro">Hello</span>
    (a) p (b) #intro (c) #box (d) .intro
  23. 23.✍️ In color: blue; which part is the value? (a) : (b) ; (c) color (d) blue
  24. 24.💪 Which flexbox property sets space between boxes? (a) justify-content (b) gap (c) align-items (d) display: flex
  25. 25.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 26px;
      }
    }
  26. 26.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 200px;
      justify-content: flex-start;
    }
    Inside are 3 boxes, each 40px wide (no margins).
  27. 27.🔍 Which is the odd one out? (a) makes a link (b) changes the page live (c) makes a form box (d) makes headings and lists
  28. 28.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 70px;
      padding: 10px;
      border: 3px solid black;
      margin: 20px;
    }
  29. 29.🖌️ What colour are the letters?
    p {
      color: white;
      font-size: 40px;
      text-align: left;
      background-color: red;
    }
    (a) red (b) white (c) purple
  30. 30.💪 Which justify-content value equal gaps, none at ends? (a) flex-end (b) space-between (c) center (d) flex-start
  31. 31.📱 max-width: 600px applies when the screen is ___. (a) 600px or wider (b) 600px or narrower (c) turned off (d) exactly 1000px
  32. 32.✍️ How many declarations (property: value pairs) are in this rule?
    h1 {
      font-weight: bold;
      width: 300px;
      margin: 10px;
    }
  33. 33.True or false: CSS makes a form box. (a) True (b) False
  34. 34.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 24px;
      }
    }
    (a) No (b) Yes
  35. 35.📱 min-width: 800px applies when the screen is ___. (a) 800px or narrower (b) exactly 100px (c) turned off (d) 800px or wider
  36. 36.🎯 What kind of selector is #hero? (a) an element selector (b) an id selector (c) a class selector
  37. 37.Which of these does HTML do? (a) lays out the page (b) makes a link (c) sets colours and fonts (d) changes the page live
  38. 38.🖌️ Where does the text sit on its line?
    li {
      background-color: green;
      font-size: 28px;
      color: orange;
      text-align: right;
    }
    (a) on the left (b) on the right (c) in the middle
  39. 39.⚖️ What colour is the text of this element?
    <h2 class="big" id="top">Hi</h2>
    CSS:
    .big { color: purple; }
    h2 { color: black; }
    #top { color: yellow; }
    (a) purple (b) black (c) yellow (d) orange
  40. 40.🌈 Which colour is #00ffff? (a) bright green (b) black (c) magenta (d) cyan

Answer key

  1. False
  2. the later one
  3. :
  4. bright green
  5. 80
  6. flex-end
  7. 80
  8. CSS
  9. 80
  10. .star
  11. 16
  12. adds space around boxes
  13. orange
  14. #
  15. True
  16. h1
  17. 2px solid
  18. 60
  19. #ff00ff
  20. Yes
  21. 2
  22. #intro
  23. blue
  24. gap
  25. 26
  26. 80
  27. changes the page live
  28. 136
  29. white
  30. space-between
  31. 600px or narrower
  32. 3
  33. False
  34. No
  35. 800px or wider
  36. an id selector
  37. makes a link
  38. on the right
  39. yellow
  40. cyan

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