← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 204 · 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.✍️ What is the selector in this CSS rule?
    .box {
      padding: 8px;
      font-style: italic;
      font-weight: bold;
      font-size: 20px;
    }
    (a) padding (b) italic (c) h2 (d) .box
  2. 2.🧩 Which language lays out the page? (a) JavaScript (b) HTML (c) CSS
  3. 3.🖌️ What colour are the letters?
    h1 {
      text-align: left;
      color: blue;
      background-color: orange;
      font-size: 24px;
    }
    (a) blue (b) purple (c) orange
  4. 4.📱 min-width: 800px applies when the screen is ___. (a) turned off (b) exactly 100px (c) 800px or wider (d) 800px or narrower
  5. 5.🖌️ Which CSS property colours behind the text? (a) font-family (b) background-color (c) font-weight (d) color
  6. 6.🎯 Which CSS selector matches this element?
    <p class="box" id="main">Hello</p>
    (a) .star (b) h1 (c) #box (d) p
  7. 7.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the later one (b) neither (c) the first one (d) the shorter one
  8. 8.What does background-color do? (a) centres a heading (b) colours behind the text (c) sets the letter colour (d) makes letters bigger
  9. 9.🎨 Which attribute adds CSS inside one tag? (a) src (b) style (c) href (d) alt
  10. 10.✍️ Which property is set to yellow in this rule?
    h1 {
      background-color: yellow;
      font-size: 20px;
    }
    (a) padding (b) margin (c) background-color (d) yellow
  11. 11.What does color do? (a) makes the text bold (b) centres a heading (c) picks the font style (d) sets the letter colour
  12. 12.🎯 What kind of selector is .card? (a) an element selector (b) a class selector (c) an id selector
  13. 13.📱 max-width: 600px applies when the screen is ___. (a) exactly 1000px (b) 600px or narrower (c) 600px or wider (d) turned off
  14. 14.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 90px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 40px wide (no margins).
  15. 15.True or false: h1 is a class selector. (a) False (b) True
  16. 16.🖌️ Which CSS property centres a heading? (a) font-family (b) text-align (c) background-color (d) font-size
  17. 17.🎨 One CSS file can style how many pages? (a) only one image (b) no pages (c) only one word (d) many pages
  18. 18.✍️ How many declarations (property: value pairs) are in this rule?
    #top {
      font-style: italic;
      font-size: 20px;
      font-weight: bold;
      margin: 10px;
    }
  19. 19.✍️ Which property is set to red in this rule?
    h1 {
      color: red;
      border: 2px solid;
    }
    (a) text-align (b) font-size (c) red (d) color
  20. 20.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 4 (b) 6 (c) 3 (d) 2
  21. 21.🖌️ What colour are the letters?
    li {
      background-color: orange;
      font-size: 16px;
      color: black;
      text-align: right;
    }
    (a) black (b) green (c) orange
  22. 22.✍️ In color: blue; which part is the value? (a) color (b) ; (c) : (d) blue
  23. 23.What does font-weight do? (a) makes letters bigger (b) centres a heading (c) makes the text bold (d) sets the letter colour
  24. 24.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 32px;
      }
    }
  25. 25.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 140px;
      justify-content: center;
    }
    Inside are 2 boxes, each 50px wide (no margins).
  26. 26.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 300px;
      padding: 10px;
      border: 1px solid black;
      margin: 20px;
    }
  27. 27.🎯 Can many elements share the same class? (a) Yes (b) No
  28. 28.🖌️ How big is the text, in px?
    h1 {
      font-size: 36px;
      background-color: green;
      color: yellow;
      text-align: center;
    }
  29. 29.Which of these does HTML do? (a) changes the text size (b) makes a form box (c) changes the page live (d) adds space around boxes
  30. 30.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 310px;
      justify-content: flex-end;
    }
    Inside are 4 boxes, each 60px wide (no margins).
  31. 31.True or false: #logo is an id selector. (a) False (b) True
  32. 32.🎯 What kind of selector is .menu? (a) an element selector (b) an id selector (c) a class selector
  33. 33.🌈 Which hex code is blue? (a) #000000 (b) #00ffff (c) #0000ff (d) #ff0000
  34. 34.🎯 What kind of selector is img? (a) an id selector (b) an element selector (c) a class selector
  35. 35.⚖️ What colour is the text of this element?
    <p class="big" id="main">Hi</p>
    CSS:
    p { color: black; }
    p { color: purple; }
    (a) white (b) red (c) black (d) purple
  36. 36.🎨 Which tag holds CSS inside the head? (a) <style> (b) <body> (c) <script> (d) <css>
  37. 37.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 180px;
      justify-content: center;
    }
    Inside are 2 boxes, each 80px wide (no margins).
  38. 38.True or false: JavaScript counts down a timer. (a) True (b) False
  39. 39.🎨 What does CSS stand for? (a) Computer Style Sheets (b) Colourful Site Styles (c) Creative Sheet System (d) Cascading Style Sheets
  40. 40.🌈 Which hex code is red? (a) #0000ff (b) #ffffff (c) #ff0000 (d) #00ff00

Answer key

  1. .box
  2. CSS
  3. blue
  4. 800px or wider
  5. background-color
  6. p
  7. the later one
  8. colours behind the text
  9. style
  10. background-color
  11. sets the letter colour
  12. a class selector
  13. 600px or narrower
  14. 10
  15. False
  16. text-align
  17. many pages
  18. 4
  19. color
  20. 3
  21. black
  22. blue
  23. makes the text bold
  24. 24
  25. 20
  26. 362
  27. Yes
  28. 36
  29. makes a form box
  30. 70
  31. True
  32. a class selector
  33. #0000ff
  34. an element selector
  35. purple
  36. <style>
  37. 10
  38. True
  39. Cascading Style Sheets
  40. #ff0000

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