← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 824 · 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="note" id="end">Hi</p>
    CSS:
    .note { color: red; }
    .note { color: black; }
    (a) black (b) blue (c) orange (d) red
  2. 2.🖌️ Where does the text sit on its line?
    h1 {
      font-size: 40px;
      color: green;
      background-color: blue;
      text-align: left;
    }
    (a) on the left (b) in the middle (c) on the right
  3. 3.🧩 Which language puts a picture on a page? (a) HTML (b) CSS (c) JavaScript
  4. 4.🔍 Which is the odd one out? (a) puts a picture on a page (b) counts down a timer (c) checks a quiz answer (d) changes the page live
  5. 5.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 2 (b) 4 (c) 3 (d) 6
  6. 6.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 200px;
      padding: 30px;
      border: 3px solid black;
      margin: 0px;
    }
  7. 7.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 20px;
      }
    }
    (a) No (b) Yes
  8. 8.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 18px;
      }
    }
    (a) Yes (b) No
  9. 9.💪 Which justify-content value packs boxes at the start? (a) center (b) space-between (c) flex-start (d) flex-end
  10. 10.True or false: the content is a solid or dotted edge. (a) False (b) True
  11. 11.True or false: .card is a class selector. (a) False (b) True
  12. 12.🎯 What kind of selector is body? (a) an element selector (b) a class selector (c) an id selector
  13. 13.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 200px;
      padding: 20px;
      border: 1px solid black;
      margin: 5px;
    }
  14. 14.🌈 In #bc0000 the red part is the hex number bc. What is it as a normal number?
  15. 15.🎯 Which element does the selector .note style? (a) <h2 class="big"> (b) <li class="red"> (c) <h2 id="note"> (d) <h2 class="note">
  16. 16.⚖️ What colour is the text of this element?
    <p class="red" id="logo">Hi</p>
    CSS:
    #logo { color: purple; }
    .red { color: blue; }
    p { color: green; }
    (a) green (b) white (c) blue (d) purple
  17. 17.🌈 Which colour is #000000? (a) white (b) cyan (c) bright green (d) black
  18. 18.True or false: padding is space outside the border. (a) False (b) True
  19. 19.True or false: JavaScript gives the page structure. (a) True (b) False
  20. 20.🖌️ Which CSS property makes letters bigger? (a) font-size (b) font-weight (c) font-family (d) text-align
  21. 21.📦 In the box model, which part is space inside the border? (a) margin (b) border (c) padding (d) content
  22. 22.⚖️ What colour is the text of this element?
    <h2 class="big" id="hero">Hi</h2>
    CSS:
    .big { color: blue; }
    .big { color: purple; }
    (a) blue (b) purple (c) green (d) black
  23. 23.🧩 Which language gives the page structure? (a) JavaScript (b) HTML (c) CSS
  24. 24.✍️ What value is given to border in this rule?
    h1 {
      padding: 8px;
      border: 2px solid;
    }
    (a) italic (b) 300px (c) 2px solid (d) border
  25. 25.🌈 In #rrggbb, which colour do the first two digits give? (a) green (b) black (c) blue (d) red
  26. 26.✍️ How many declarations (property: value pairs) are in this rule?
    p {
      text-align: center;
      color: red;
    }
  27. 27.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the shorter one (b) the first one (c) neither (d) the later one
  28. 28.✍️ In color: blue; which part is the property? (a) : (b) blue (c) ; (d) color
  29. 29.🖌️ Where does the text sit on its line?
    li {
      background-color: red;
      text-align: left;
      font-size: 40px;
      color: yellow;
    }
    (a) on the right (b) in the middle (c) on the left
  30. 30.📱 The screen is 414px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 28px;
      }
    }
    (a) No (b) Yes
  31. 31.📱 The screen is 414px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 18px;
      }
    }
    (a) Yes (b) No
  32. 32.📱 min-width: 800px applies when the screen is ___. (a) exactly 100px (b) 800px or wider (c) turned off (d) 800px or narrower
  33. 33.🌈 Which hex code is bright green? (a) #00ff00 (b) #0000ff (c) #ffffff (d) #000000
  34. 34.What does font-size do? (a) makes letters bigger (b) sets the letter colour (c) colours behind the text (d) makes the text bold
  35. 35.✍️ How many declarations (property: value pairs) are in this rule?
    li {
      font-style: italic;
      font-weight: bold;
    }
  36. 36.🔍 Which is the odd one out? (a) makes a link (b) checks a quiz answer (c) gives the page structure (d) makes headings and lists
  37. 37.🎨 Which tag holds CSS inside the head? (a) <css> (b) <body> (c) <script> (d) <style>
  38. 38.True or false: HTML checks a quiz answer. (a) True (b) False
  39. 39.Which of these does HTML do? (a) rounds box corners (b) puts a picture on a page (c) adds space around boxes (d) changes the text size
  40. 40.🌈 Which colour is rgb(0, 0, 255)? (a) blue (b) red (c) white (d) yellow

Answer key

  1. black
  2. on the left
  3. HTML
  4. puts a picture on a page
  5. 3
  6. 266
  7. No
  8. No
  9. flex-start
  10. False
  11. True
  12. an element selector
  13. 252
  14. 188
  15. <h2 class="note">
  16. purple
  17. black
  18. False
  19. False
  20. font-size
  21. padding
  22. purple
  23. HTML
  24. 2px solid
  25. red
  26. 2
  27. the later one
  28. color
  29. on the left
  30. No
  31. Yes
  32. 800px or wider
  33. #00ff00
  34. makes letters bigger
  35. 2
  36. checks a quiz answer
  37. <style>
  38. False
  39. puts a picture on a page
  40. blue

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