← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 128 · 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 colour is the text of this element?
    <p class="box" id="top">Hi</p>
    CSS:
    #top { color: red; }
    #top { color: black; }
    (a) orange (b) black (c) red (d) green
  2. 2.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 20px;
      }
    }
    (a) No (b) Yes
  3. 3.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 8px;
      }
    }
  4. 4.🎨 What does CSS stand for? (a) Computer Style Sheets (b) Cascading Style Sheets (c) Colourful Site Styles (d) Creative Sheet System
  5. 5.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 14px;
      }
    }
  6. 6.🎯 Which element does the selector #logo style? (a) <p id="logo"> (b) <h1 class="box"> (c) <p id="end"> (d) <p class="logo">
  7. 7.🎯 Which sign starts an id selector? (a) # (b) . (c) & (d) @
  8. 8.🌈 Which colour of light is strongest in rgb(128, 134, 154)? (a) blue (b) red (c) green
  9. 9.True or false: HTML makes headings and lists. (a) True (b) False
  10. 10.🎯 What kind of selector is .star? (a) an element selector (b) a class selector (c) an id selector
  11. 11.Which of these does HTML do? (a) rounds box corners (b) makes a link (c) shows a pop-up message (d) adds space around boxes
  12. 12.⚖️ What colour is the text of this element?
    <h2 class="note" id="end">Hi</h2>
    CSS:
    h2 { color: orange; }
    h2 { color: green; }
    (a) red (b) green (c) white (d) orange
  13. 13.✍️ Which sign ends each CSS declaration? (a) , (b) ; (c) : (d) .
  14. 14.Which of these does CSS do? (a) makes headings and lists (b) changes the text size (c) shows a pop-up message (d) reacts to a button click
  15. 15.🎯 How many elements on a page should have the same id? (a) 2 (b) any number (c) 5 (d) 1
  16. 16.📱 max-width: 600px applies when the screen is ___. (a) 600px or narrower (b) 600px or wider (c) turned off (d) exactly 1000px
  17. 17.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the first one (b) the later one (c) the shorter one (d) neither
  18. 18.⚖️ What colour is the text of this element?
    <h2 class="big" id="hero">Hi</h2>
    CSS:
    .big { color: blue; }
    h2 { color: green; }
    (a) green (b) white (c) blue (d) purple
  19. 19.True or false: padding is space inside the border. (a) True (b) False
  20. 20.True or false: the content is space outside the border. (a) False (b) True
  21. 21.🎯 What kind of selector is h1? (a) an id selector (b) an element selector (c) a class selector
  22. 22.🖌️ Which CSS property sets the letter colour? (a) background-color (b) font-size (c) font-weight (d) color
  23. 23.✍️ Which sign goes between a property and its value? (a) - (b) ; (c) = (d) :
  24. 24.True or false: h1 is a class selector. (a) False (b) True
  25. 25.✍️ In color: blue; which part is the value? (a) blue (b) ; (c) : (d) color
  26. 26.⚖️ What colour is the text of this element?
    <h1 class="big" id="hero">Hi</h1>
    CSS:
    #hero { color: red; }
    #hero { color: white; }
    (a) orange (b) red (c) white (d) green
  27. 27.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 180px;
      padding: 30px;
      border: 5px solid black;
      margin: 10px;
    }
  28. 28.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 10px;
      }
    }
  29. 29.📱 Which tag helps phones show a page at the right size? (a) the title tag (b) the br tag (c) the hr tag (d) the viewport meta tag
  30. 30.🌈 Which colour is #000000? (a) bright green (b) black (c) red (d) magenta
  31. 31.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 140px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 50px wide (no margins).
  32. 32.🧩 Which language makes headings and lists? (a) CSS (b) HTML (c) JavaScript
  33. 33.✍️ Which property is set to red in this rule?
    h1 {
      color: red;
      background-color: yellow;
      text-align: center;
      font-size: 20px;
    }
    (a) font-size (b) text-align (c) red (d) color
  34. 34.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 90px;
      padding: 10px;
      border: 5px solid black;
      margin: 20px;
    }
  35. 35.📱 The screen is 700px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 18px;
      }
    }
    (a) No (b) Yes
  36. 36.✍️ What value is given to text-align in this rule?
    #top {
      text-align: center;
      background-color: yellow;
      font-size: 20px;
    }
    (a) yellow (b) 10px (c) text-align (d) center
  37. 37.🎯 What kind of selector is #logo? (a) a class selector (b) an id selector (c) an element selector
  38. 38.What does color do? (a) makes the text bold (b) makes letters bigger (c) centres a heading (d) sets the letter colour
  39. 39.💪 Which flexbox property lines boxes up across? (a) flex-direction (b) display: flex (c) justify-content (d) align-items
  40. 40.🎯 Which CSS selector matches this element?
    <p class="box" id="end">Hello</p>
    (a) #end (b) #hero (c) h1 (d) #box

Answer key

  1. black
  2. Yes
  3. 8
  4. Cascading Style Sheets
  5. 14
  6. <p id="logo">
  7. #
  8. blue
  9. True
  10. a class selector
  11. makes a link
  12. green
  13. ;
  14. changes the text size
  15. 1
  16. 600px or narrower
  17. the later one
  18. blue
  19. True
  20. False
  21. an element selector
  22. color
  23. :
  24. False
  25. blue
  26. white
  27. 270
  28. 10
  29. the viewport meta tag
  30. black
  31. 40
  32. HTML
  33. color
  34. 160
  35. No
  36. center
  37. an id selector
  38. sets the letter colour
  39. align-items
  40. #end

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