← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 803 · 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 CSS selector matches this element?
    <li class="star" id="intro">Hello</li>
    (a) #intro (b) .intro (c) #star (d) #main
  2. 2.⚖️ What colour is the text of this element?
    <p class="menu" id="logo">Hi</p>
    CSS:
    #logo { color: yellow; }
    #logo { color: blue; }
    (a) orange (b) green (c) yellow (d) blue
  3. 3.🎯 Which CSS selector matches this element?
    <div class="menu" id="top">Hello</div>
    (a) span (b) .note (c) #intro (d) div
  4. 4.🖌️ Where does the text sit on its line?
    li {
      text-align: right;
      color: green;
      background-color: black;
      font-size: 12px;
    }
    (a) on the left (b) on the right (c) in the middle
  5. 5.📱 max-width: 600px applies when the screen is ___. (a) exactly 1000px (b) turned off (c) 600px or wider (d) 600px or narrower
  6. 6.🖌️ What colour is behind the letters?
    li {
      font-size: 12px;
      color: yellow;
      text-align: right;
      background-color: black;
    }
    (a) blue (b) black (c) yellow
  7. 7.🖌️ What colour are the letters?
    h1 {
      text-align: center;
      background-color: green;
      font-size: 24px;
      color: red;
    }
    (a) green (b) red (c) orange
  8. 8.🔍 Which is the odd one out? (a) adds space around boxes (b) sets colours and fonts (c) puts a picture on a page (d) rounds box corners
  9. 9.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 14px;
      }
    }
  10. 10.True or false: the border is the gap to other boxes. (a) True (b) False
  11. 11.What does font-family do? (a) makes letters bigger (b) centres a heading (c) sets the letter colour (d) picks the font style
  12. 12.✍️ How many declarations (property: value pairs) are in this rule?
    h1 {
      font-style: italic;
      text-align: center;
      width: 300px;
    }
  13. 13.What does font-size do? (a) makes letters bigger (b) sets the letter colour (c) colours behind the text (d) centres a heading
  14. 14.✍️ Which property is set to red in this rule?
    body {
      background-color: yellow;
      color: red;
    }
    (a) color (b) text-align (c) red (d) font-size
  15. 15.✍️ How many declarations (property: value pairs) are in this rule?
    body {
      color: red;
    }
  16. 16.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 28px;
      }
    }
  17. 17.📱 min-width: 800px applies when the screen is ___. (a) 800px or narrower (b) turned off (c) 800px or wider (d) exactly 100px
  18. 18.🌈 In #980000 the red part is the hex number 98. What is it as a normal number?
  19. 19.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 18px;
      }
    }
  20. 20.🌈 Which colour is #000000? (a) magenta (b) blue (c) black (d) white
  21. 21.What does background-color do? (a) centres a heading (b) picks the font style (c) sets the letter colour (d) colours behind the text
  22. 22.⚖️ What colour is the text of this element?
    <h1 class="menu" id="top">Hi</h1>
    CSS:
    h1 { color: white; }
    h1 { color: green; }
    (a) purple (b) white (c) green (d) red
  23. 23.🖌️ Which CSS property makes the text bold? (a) font-size (b) font-family (c) font-weight (d) color
  24. 24.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 180px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 80px wide (no margins).
  25. 25.⚖️ What colour is the text of this element?
    <h1 class="note" id="end">Hi</h1>
    CSS:
    #end { color: blue; }
    #end { color: white; }
    (a) red (b) white (c) blue (d) green
  26. 26.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 400px;
      justify-content: space-between;
    }
    Inside are 3 boxes, each 80px wide (no margins).
  27. 27.🎯 Which CSS selector matches this element?
    <div class="menu" id="intro">Hello</div>
    (a) #menu (b) .menu (c) #main (d) span
  28. 28.📱 What does a media query check? (a) the battery level (b) the screen width (c) the page title (d) the time of day
  29. 29.🧩 Which language shows a pop-up message? (a) HTML (b) CSS (c) JavaScript
  30. 30.🎨 What does CSS stand for? (a) Creative Sheet System (b) Colourful Site Styles (c) Computer Style Sheets (d) Cascading Style Sheets
  31. 31.✍️ Which sign ends each CSS declaration? (a) . (b) , (c) ; (d) :
  32. 32.True or false: #logo is an id selector. (a) True (b) False
  33. 33.True or false: the content is the line round the box. (a) True (b) False
  34. 34.🎨 Which tag connects an outside CSS file? (a) <link> (b) <a> (c) <img> (d) <css>
  35. 35.⚖️ What colour is the text of this element?
    <h1 class="note" id="main">Hi</h1>
    CSS:
    #main { color: yellow; }
    h1 { color: black; }
    (a) black (b) yellow (c) orange (d) green
  36. 36.🌈 In #7e0000 the red part is the hex number 7e. What is it as a normal number?
  37. 37.🖌️ What colour are the letters?
    h1 {
      color: blue;
      font-size: 16px;
      text-align: right;
      background-color: green;
    }
    (a) green (b) red (c) blue
  38. 38.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 120px;
      justify-content: space-between;
    }
    Inside are 2 boxes, each 40px wide (no margins).
  39. 39.True or false: CSS rounds box corners. (a) False (b) True
  40. 40.✍️ What value is given to margin in this rule?
    p {
      font-size: 20px;
      margin: 10px;
      border: 2px solid;
    }
    (a) 10px (b) margin (c) bold (d) 8px

Answer key

  1. #intro
  2. blue
  3. div
  4. on the right
  5. 600px or narrower
  6. black
  7. red
  8. puts a picture on a page
  9. 12
  10. False
  11. picks the font style
  12. 3
  13. makes letters bigger
  14. color
  15. 1
  16. 24
  17. 800px or wider
  18. 152
  19. 18
  20. black
  21. colours behind the text
  22. green
  23. font-weight
  24. 20
  25. white
  26. 80
  27. .menu
  28. the screen width
  29. JavaScript
  30. Cascading Style Sheets
  31. ;
  32. True
  33. False
  34. <link>
  35. yellow
  36. 126
  37. blue
  38. 40
  39. True
  40. 10px

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