← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 181 · 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 starts a class selector? (a) & (b) @ (c) # (d) .
  2. 2.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 400px;
      justify-content: space-between;
    }
    Inside are 4 boxes, each 40px wide (no margins).
  3. 3.True or false: padding is space inside the border. (a) False (b) True
  4. 4.🔍 Which is the odd one out? (a) checks a quiz answer (b) makes a link (c) counts down a timer (d) shows a pop-up message
  5. 5.✍️ In color: blue; which part is the property? (a) ; (b) : (c) color (d) blue
  6. 6.✍️ Which property is set to italic in this rule?
    h1 {
      margin: 10px;
      text-align: center;
      font-style: italic;
    }
    (a) font-style (b) font-size (c) color (d) italic
  7. 7.True or false: body is an element selector. (a) False (b) True
  8. 8.📱 Which tag helps phones show a page at the right size? (a) the br tag (b) the hr tag (c) the viewport meta tag (d) the title tag
  9. 9.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 22px;
      }
    }
  10. 10.🧩 Which language checks a quiz answer? (a) HTML (b) CSS (c) JavaScript
  11. 11.True or false: padding is the gap to other boxes. (a) True (b) False
  12. 12.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 14px;
      }
    }
  13. 13.✍️ Which property is set to 20px in this rule?
    .box {
      border: 2px solid;
      color: red;
      font-size: 20px;
    }
    (a) 20px (b) background-color (c) font-size (d) text-align
  14. 14.🖌️ Where does the text sit on its line?
    li {
      text-align: center;
      color: green;
      font-size: 40px;
      background-color: purple;
    }
    (a) in the middle (b) on the right (c) on the left
  15. 15.🖌️ Which CSS property sets the letter colour? (a) color (b) background-color (c) font-size (d) font-family
  16. 16.🌈 Which colour is #0000ff? (a) black (b) blue (c) bright green (d) cyan
  17. 17.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 120px;
      padding: 15px;
      border: 4px solid black;
      margin: 20px;
    }
  18. 18.🌈 Which hex code is bright green? (a) #00ff00 (b) #ff0000 (c) #ffff00 (d) #ffffff
  19. 19.🌈 In #007c00 the green part is the hex number 7c. What is it as a normal number?
  20. 20.Which of these does HTML do? (a) sets colours and fonts (b) reacts to a button click (c) puts a picture on a page (d) changes the page live
  21. 21.✍️ Which property is set to italic in this rule?
    .box {
      margin: 10px;
      font-style: italic;
    }
    (a) color (b) italic (c) font-style (d) font-size
  22. 22.✍️ What value is given to text-align in this rule?
    body {
      font-style: italic;
      font-weight: bold;
      text-align: center;
    }
    (a) text-align (b) yellow (c) center (d) 10px
  23. 23.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 2 (b) 3 (c) 6 (d) 4
  24. 24.✍️ Which sign goes between a property and its value? (a) - (b) : (c) = (d) ;
  25. 25.🖌️ What colour is behind the letters?
    p {
      color: black;
      text-align: right;
      background-color: blue;
      font-size: 40px;
    }
    (a) blue (b) white (c) black
  26. 26.⚖️ What colour is the text of this element?
    <h1 class="big" id="logo">Hi</h1>
    CSS:
    h1 { color: green; }
    #logo { color: yellow; }
    (a) green (b) yellow (c) purple (d) black
  27. 27.🎯 What kind of selector is #logo? (a) an id selector (b) a class selector (c) an element selector
  28. 28.🎯 What kind of selector is #main? (a) a class selector (b) an id selector (c) an element selector
  29. 29.📱 The screen is 540px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 26px;
      }
    }
    (a) No (b) Yes
  30. 30.Which of these does JavaScript do? (a) sets colours and fonts (b) adds space around boxes (c) checks a quiz answer (d) makes a form box
  31. 31.🎯 Which element does the selector .red style? (a) <h2 id="red"> (b) <h2 class="red"> (c) <h2 class="box"> (d) <li class="star">
  32. 32.What does font-weight do? (a) centres a heading (b) makes the text bold (c) sets the letter colour (d) picks the font style
  33. 33.🧩 Which language makes headings and lists? (a) JavaScript (b) CSS (c) HTML
  34. 34.🔍 Which is the odd one out? (a) makes headings and lists (b) puts a picture on a page (c) makes a form box (d) lays out the page
  35. 35.⚖️ What colour is the text of this element?
    <h2 class="menu" id="hero">Hi</h2>
    CSS:
    h2 { color: red; }
    h2 { color: white; }
    (a) red (b) white (c) black (d) orange
  36. 36.🎯 Can many elements share the same class? (a) Yes (b) No
  37. 37.🧩 Which language reacts to a button click? (a) JavaScript (b) HTML (c) CSS
  38. 38.🎯 Which sign starts an id selector? (a) & (b) @ (c) # (d) .
  39. 39.✍️ How does a CSS comment start? (a) <!-- (b) // (c) /* (d) #
  40. 40.🌈 In #a10000 the red part is the hex number a1. What is it as a normal number?

Answer key

  1. .
  2. 80
  3. True
  4. makes a link
  5. color
  6. font-style
  7. True
  8. the viewport meta tag
  9. 22
  10. JavaScript
  11. False
  12. 16
  13. font-size
  14. in the middle
  15. color
  16. blue
  17. 198
  18. #00ff00
  19. 124
  20. puts a picture on a page
  21. font-style
  22. center
  23. 3
  24. :
  25. blue
  26. yellow
  27. an id selector
  28. an id selector
  29. No
  30. checks a quiz answer
  31. <h2 class="red">
  32. makes the text bold
  33. HTML
  34. lays out the page
  35. white
  36. Yes
  37. JavaScript
  38. #
  39. /*
  40. 161

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