← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 8 · 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.🖌️ How big is the text, in px?
    h1 {
      text-align: left;
      color: orange;
      font-size: 40px;
      background-color: white;
    }
  2. 2.What does justify-content: flex-start do? (a) puts boxes in the middle (b) packs boxes at the end (c) packs boxes at the start (d) equal gaps, none at ends
  3. 3.💪 Which justify-content value puts boxes in the middle? (a) space-between (b) center (c) flex-end (d) flex-start
  4. 4.🌈 Which colour is rgb(0, 255, 0)? (a) white (b) cyan (c) magenta (d) bright green
  5. 5.🌈 Which colour of light is strongest in rgb(171, 74, 16)? (a) blue (b) green (c) red
  6. 6.True or false: CSS makes headings and lists. (a) False (b) True
  7. 7.⚖️ What colour is the text of this element?
    <h1 class="note" id="main">Hi</h1>
    CSS:
    #main { color: black; }
    #main { color: green; }
    (a) black (b) red (c) white (d) green
  8. 8.🎯 Which element does the selector #intro style? (a) <span class="note"> (b) <div id="intro"> (c) <div class="intro"> (d) <div id="main">
  9. 9.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 160px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 40px wide (no margins).
  10. 10.📱 min-width: 800px applies when the screen is ___. (a) exactly 100px (b) 800px or narrower (c) turned off (d) 800px or wider
  11. 11.📱 What does a media query check? (a) the screen width (b) the time of day (c) the battery level (d) the page title
  12. 12.🧩 Which language counts down a timer? (a) HTML (b) JavaScript (c) CSS
  13. 13.What does justify-content: center do? (a) packs boxes at the end (b) packs boxes at the start (c) equal gaps, none at ends (d) puts boxes in the middle
  14. 14.🖌️ What colour are the letters?
    h2 {
      font-size: 36px;
      text-align: right;
      background-color: purple;
      color: black;
    }
    (a) black (b) red (c) purple
  15. 15.🌈 In #000074 the blue part is the hex number 74. What is it as a normal number?
  16. 16.✍️ How many declarations (property: value pairs) are in this rule?
    h2 {
      font-weight: bold;
      color: red;
    }
  17. 17.🧩 Which language lays out the page? (a) JavaScript (b) CSS (c) HTML
  18. 18.🎨 What does CSS stand for? (a) Colourful Site Styles (b) Computer Style Sheets (c) Cascading Style Sheets (d) Creative Sheet System
  19. 19.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 460px;
      justify-content: flex-end;
    }
    Inside are 4 boxes, each 100px wide (no margins).
  20. 20.🔍 Which is the odd one out? (a) rounds box corners (b) sets colours and fonts (c) lays out the page (d) makes headings and lists
  21. 21.✍️ Which property is set to 300px in this rule?
    .box {
      width: 300px;
      color: red;
      background-color: yellow;
      font-size: 20px;
    }
    (a) width (b) font-style (c) color (d) 300px
  22. 22.🌈 Which colour is #ffffff? (a) yellow (b) blue (c) red (d) white
  23. 23.✍️ In color: blue; which part is the property? (a) ; (b) : (c) color (d) blue
  24. 24.🖌️ Which CSS property colours behind the text? (a) background-color (b) text-align (c) font-size (d) font-family
  25. 25.💪 Which flexbox property turns on flexbox? (a) gap (b) align-items (c) justify-content (d) display: flex
  26. 26.🎨 Which tag holds CSS inside the head? (a) <style> (b) <script> (c) <body> (d) <css>
  27. 27.🧩 Which language reacts to a button click? (a) HTML (b) CSS (c) JavaScript
  28. 28.✍️ Which property is set to italic in this rule?
    #top {
      font-size: 20px;
      margin: 10px;
      font-style: italic;
      background-color: yellow;
    }
    (a) font-style (b) italic (c) font-size (d) color
  29. 29.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 230px;
      padding: 25px;
      border: 1px solid black;
      margin: 0px;
    }
  30. 30.🖌️ How big is the text, in px?
    li {
      text-align: right;
      color: green;
      font-size: 12px;
      background-color: red;
    }
  31. 31.What does color do? (a) makes the text bold (b) colours behind the text (c) makes letters bigger (d) sets the letter colour
  32. 32.✍️ How many declarations (property: value pairs) are in this rule?
    #top {
      padding: 8px;
      border: 2px solid;
      color: red;
    }
  33. 33.✍️ Which property is set to 10px in this rule?
    p {
      font-style: italic;
      margin: 10px;
    }
    (a) margin (b) font-weight (c) 10px (d) padding
  34. 34.🎯 Which CSS selector matches this element?
    <h1 class="star" id="end">Hello</h1>
    (a) .star (b) .menu (c) #star (d) h2
  35. 35.True or false: CSS puts a picture on a page. (a) False (b) True
  36. 36.🧩 Which language changes the page live? (a) CSS (b) JavaScript (c) HTML
  37. 37.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 26px;
      }
    }
  38. 38.✍️ How many declarations (property: value pairs) are in this rule?
    h1 {
      width: 300px;
      background-color: yellow;
    }
  39. 39.⚖️ What colour is the text of this element?
    <p class="red" id="main">Hi</p>
    CSS:
    #main { color: blue; }
    #main { color: green; }
    (a) green (b) white (c) blue (d) yellow
  40. 40.🌈 Which colour of light is strongest in rgb(202, 34, 109)? (a) red (b) blue (c) green

Answer key

  1. 40
  2. packs boxes at the start
  3. center
  4. bright green
  5. red
  6. False
  7. green
  8. <div id="intro">
  9. 80
  10. 800px or wider
  11. the screen width
  12. JavaScript
  13. puts boxes in the middle
  14. black
  15. 116
  16. 2
  17. CSS
  18. Cascading Style Sheets
  19. 60
  20. makes headings and lists
  21. width
  22. white
  23. color
  24. background-color
  25. display: flex
  26. <style>
  27. JavaScript
  28. font-style
  29. 282
  30. 12
  31. sets the letter colour
  32. 3
  33. margin
  34. .star
  35. False
  36. JavaScript
  37. 20
  38. 2
  39. green
  40. red

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