← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 869 · 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 sign ends each CSS declaration? (a) . (b) ; (c) : (d) ,
  2. 2.🎨 Which tag holds CSS inside the head? (a) <style> (b) <css> (c) <script> (d) <body>
  3. 3.🌈 Which hex code is cyan? (a) #00ffff (b) #0000ff (c) #ffffff (d) #ff00ff
  4. 4.🎯 What kind of selector is #end? (a) an id selector (b) an element selector (c) a class selector
  5. 5.🌈 Which colour is #000000? (a) red (b) black (c) bright green (d) magenta
  6. 6.🖌️ What colour is behind the letters?
    p {
      text-align: right;
      font-size: 36px;
      color: yellow;
      background-color: red;
    }
    (a) white (b) red (c) yellow
  7. 7.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 200px;
      justify-content: flex-end;
    }
    Inside are 4 boxes, each 40px wide (no margins).
  8. 8.✍️ How does a CSS comment start? (a) // (b) /* (c) # (d) <!--
  9. 9.📱 Responsive design means a page ___. (a) never changes (b) has no pictures (c) is only for laptops (d) fits every screen
  10. 10.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 14px;
      }
    }
  11. 11.⚖️ Which selector is the strongest? (a) an element selector (b) an id selector (c) a class selector
  12. 12.🎯 Which element does the selector h1 style? (a) <li class="star"> (b) <h1 class="star"> (c) <div id="hero"> (d) <h2>
  13. 13.True or false: CSS makes headings and lists. (a) False (b) True
  14. 14.✍️ What is the selector in this CSS rule?
    p {
      color: red;
      width: 300px;
      border: 2px solid;
    }
    (a) color (b) p (c) 300px (d) .note
  15. 15.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 20px;
      }
    }
    (a) Yes (b) No
  16. 16.⚖️ What colour is the text of this element?
    <p class="big" id="intro">Hi</p>
    CSS:
    p { color: yellow; }
    p { color: green; }
    (a) purple (b) white (c) green (d) yellow
  17. 17.True or false: CSS reacts to a button click. (a) False (b) True
  18. 18.What does font-weight do? (a) makes the text bold (b) picks the font style (c) centres a heading (d) colours behind the text
  19. 19.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the first one (b) neither (c) the later one (d) the shorter one
  20. 20.⚖️ What colour is the text of this element?
    <p class="red" id="top">Hi</p>
    CSS:
    p { color: yellow; }
    p { color: blue; }
    (a) purple (b) yellow (c) blue (d) green
  21. 21.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 300px;
      padding: 20px;
      border: 1px solid black;
      margin: 0px;
    }
  22. 22.⚖️ What colour is the text of this element?
    <p class="note" id="top">Hi</p>
    CSS:
    .note { color: green; }
    .note { color: blue; }
    (a) red (b) orange (c) green (d) blue
  23. 23.📱 The screen is 700px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 22px;
      }
    }
    (a) No (b) Yes
  24. 24.🌈 Which colour is rgb(255, 0, 0)? (a) white (b) red (c) yellow (d) cyan
  25. 25.📱 min-width: 800px applies when the screen is ___. (a) 800px or narrower (b) turned off (c) exactly 100px (d) 800px or wider
  26. 26.⚖️ What colour is the text of this element?
    <h2 class="menu" id="top">Hi</h2>
    CSS:
    #top { color: purple; }
    #top { color: white; }
    (a) blue (b) white (c) purple (d) black
  27. 27.🖌️ Which CSS property centres a heading? (a) font-family (b) text-align (c) background-color (d) font-size
  28. 28.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 120px;
      padding: 5px;
      border: 4px solid black;
      margin: 15px;
    }
  29. 29.📱 The screen is 1100px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 20px;
      }
    }
    (a) Yes (b) No
  30. 30.💪 Which justify-content value packs boxes at the start? (a) flex-end (b) center (c) space-between (d) flex-start
  31. 31.🎯 Which CSS selector matches this element?
    <p class="big" id="top">Hello</p>
    (a) #big (b) #intro (c) #top (d) .red
  32. 32.✍️ How many declarations (property: value pairs) are in this rule?
    .note {
      width: 300px;
    }
  33. 33.🎯 What kind of selector is .menu? (a) a class selector (b) an id selector (c) an element selector
  34. 34.🎯 What kind of selector is #main? (a) a class selector (b) an element selector (c) an id selector
  35. 35.🌈 Which hex code is yellow? (a) #ff0000 (b) #ffff00 (c) #0000ff (d) #ff00ff
  36. 36.⚖️ Which selector is the weakest? (a) a class selector (b) an id selector (c) an element selector
  37. 37.✍️ How many declarations (property: value pairs) are in this rule?
    .note {
      margin: 10px;
      font-style: italic;
      font-weight: bold;
    }
  38. 38.🔍 Which is the odd one out? (a) rounds box corners (b) lays out the page (c) sets colours and fonts (d) changes the page live
  39. 39.🎯 How many elements on a page should have the same id? (a) 5 (b) 2 (c) any number (d) 1
  40. 40.True or false: .menu is a class selector. (a) True (b) False

Answer key

  1. ;
  2. <style>
  3. #00ffff
  4. an id selector
  5. black
  6. red
  7. 40
  8. /*
  9. fits every screen
  10. 14
  11. an id selector
  12. <h1 class="star">
  13. False
  14. p
  15. No
  16. green
  17. False
  18. makes the text bold
  19. the later one
  20. blue
  21. 342
  22. blue
  23. Yes
  24. red
  25. 800px or wider
  26. white
  27. text-align
  28. 138
  29. Yes
  30. flex-start
  31. #top
  32. 1
  33. a class selector
  34. an id selector
  35. #ffff00
  36. an element selector
  37. 3
  38. changes the page live
  39. 1
  40. True

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