← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 136 · 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?
    <h1 class="big" id="logo">Hi</h1>
    CSS:
    .big { color: green; }
    .big { color: black; }
    (a) white (b) blue (c) black (d) green
  2. 2.✍️ In color: blue; which part is the value? (a) color (b) : (c) ; (d) blue
  3. 3.✍️ What is the selector in this CSS rule?
    h1 {
      font-size: 20px;
      background-color: yellow;
      color: red;
    }
    (a) yellow (b) font-size (c) h1 (d) p
  4. 4.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 230px;
      padding: 5px;
      border: 2px solid black;
      margin: 10px;
    }
  5. 5.🌈 In #rrggbb, which colour do the first two digits give? (a) red (b) green (c) black (d) blue
  6. 6.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 200px;
      padding: 15px;
      border: 4px solid black;
      margin: 0px;
    }
  7. 7.🎨 Which attribute adds CSS inside one tag? (a) alt (b) href (c) src (d) style
  8. 8.🌈 Which colour is rgb(255, 255, 0)? (a) yellow (b) red (c) black (d) white
  9. 9.📦 In the box model, which part is a solid or dotted edge? (a) padding (b) margin (c) border (d) content
  10. 10.✍️ What is the selector in this CSS rule?
    p {
      background-color: yellow;
      width: 300px;
    }
    (a) 300px (b) background-color (c) .note (d) p
  11. 11.🎯 Which element does the selector #hero style? (a) <span class="red"> (b) <div id="hero"> (c) <div id="top"> (d) <div class="hero">
  12. 12.Which of these does CSS do? (a) gives the page structure (b) checks a quiz answer (c) makes headings and lists (d) lays out the page
  13. 13.✍️ How many declarations (property: value pairs) are in this rule?
    li {
      padding: 8px;
      background-color: yellow;
      font-size: 20px;
    }
  14. 14.⚖️ Two rules with the same selector set a colour. Which one wins? (a) neither (b) the later one (c) the shorter one (d) the first one
  15. 15.💪 Which justify-content value puts boxes in the middle? (a) center (b) flex-start (c) flex-end (d) space-between
  16. 16.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 150px;
      padding: 15px;
      border: 3px solid black;
      margin: 15px;
    }
  17. 17.🌈 Which colour of light is strongest in rgb(173, 102, 1)? (a) red (b) green (c) blue
  18. 18.📱 The screen is 700px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 22px;
      }
    }
    (a) Yes (b) No
  19. 19.✍️ Which sign goes between a property and its value? (a) : (b) = (c) ; (d) -
  20. 20.🌈 In #000097 the blue part is the hex number 97. What is it as a normal number?
  21. 21.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 270px;
      padding: 5px;
      border: 4px solid black;
      margin: 20px;
    }
  22. 22.🖌️ Where does the text sit on its line?
    p {
      font-size: 40px;
      background-color: yellow;
      color: red;
      text-align: right;
    }
    (a) on the right (b) on the left (c) in the middle
  23. 23.🎯 Which CSS selector matches this element?
    <li class="box" id="main">Hello</li>
    (a) li (b) div (c) #logo (d) .main
  24. 24.📱 The screen is 1100px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 18px;
      }
    }
    (a) Yes (b) No
  25. 25.🖌️ Which CSS property sets the letter colour? (a) font-weight (b) color (c) background-color (d) font-size
  26. 26.🎯 Which CSS selector matches this element?
    <p class="note" id="logo">Hello</p>
    (a) #note (b) .logo (c) .big (d) .note
  27. 27.🎯 What kind of selector is .big? (a) a class selector (b) an element selector (c) an id selector
  28. 28.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 10px;
      }
    }
  29. 29.✍️ How many declarations (property: value pairs) are in this rule?
    body {
      font-weight: bold;
    }
  30. 30.📱 The screen is 414px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 32px;
      }
    }
    (a) No (b) Yes
  31. 31.🌈 Which colour is #0000ff? (a) blue (b) yellow (c) magenta (d) red
  32. 32.🌈 Which colour of light is strongest in rgb(78, 169, 62)? (a) green (b) red (c) blue
  33. 33.🔍 Which is the odd one out? (a) makes headings and lists (b) makes a link (c) makes a form box (d) sets colours and fonts
  34. 34.🎨 One CSS file can style how many pages? (a) only one image (b) only one word (c) no pages (d) many pages
  35. 35.💪 Which flexbox property spaces boxes along a row? (a) justify-content (b) display: flex (c) flex-direction (d) align-items
  36. 36.📱 min-width: 800px applies when the screen is ___. (a) exactly 100px (b) 800px or narrower (c) 800px or wider (d) turned off
  37. 37.💪 Which flexbox property picks row or column? (a) flex-direction (b) justify-content (c) align-items (d) display: flex
  38. 38.🎯 What kind of selector is .menu? (a) an id selector (b) a class selector (c) an element selector
  39. 39.True or false: the content is the text or picture. (a) False (b) True
  40. 40.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 2 (b) 6 (c) 3 (d) 4

Answer key

  1. black
  2. blue
  3. h1
  4. 264
  5. red
  6. 238
  7. style
  8. yellow
  9. border
  10. p
  11. <div id="hero">
  12. lays out the page
  13. 3
  14. the later one
  15. center
  16. 186
  17. red
  18. Yes
  19. :
  20. 151
  21. 328
  22. on the right
  23. li
  24. Yes
  25. color
  26. .note
  27. a class selector
  28. 10
  29. 1
  30. No
  31. blue
  32. green
  33. sets colours and fonts
  34. many pages
  35. justify-content
  36. 800px or wider
  37. flex-direction
  38. a class selector
  39. True
  40. 3

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