← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 69 · 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.📱 Responsive design means a page ___. (a) never changes (b) has no pictures (c) is only for laptops (d) fits every screen
  2. 2.💪 Which flexbox property picks row or column? (a) flex-direction (b) justify-content (c) gap (d) align-items
  3. 3.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 80px;
      padding: 5px;
      border: 1px solid black;
      margin: 5px;
    }
  4. 4.🔍 Which is the odd one out? (a) gives the page structure (b) reacts to a button click (c) counts down a timer (d) shows a pop-up message
  5. 5.🎯 Which sign starts a class selector? (a) & (b) @ (c) # (d) .
  6. 6.🎨 Which tag connects an outside CSS file? (a) <link> (b) <img> (c) <a> (d) <css>
  7. 7.🌈 Which hex code is yellow? (a) #00ff00 (b) #ffffff (c) #ffff00 (d) #ff0000
  8. 8.🌈 In #0000f2 the blue part is the hex number f2. What is it as a normal number?
  9. 9.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 310px;
      justify-content: space-between;
    }
    Inside are 4 boxes, each 40px wide (no margins).
  10. 10.Which of these is padding? (a) a solid or dotted edge (b) the text or picture (c) the line round the box (d) space inside the border
  11. 11.✍️ How many declarations (property: value pairs) are in this rule?
    .note {
      text-align: center;
    }
  12. 12.✍️ What is the selector in this CSS rule?
    body {
      font-style: italic;
      background-color: yellow;
      padding: 8px;
      margin: 10px;
    }
    (a) font-style (b) yellow (c) .box (d) body
  13. 13.🎨 One CSS file can style how many pages? (a) no pages (b) many pages (c) only one word (d) only one image
  14. 14.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 26px;
      }
    }
  15. 15.🔍 Which is the odd one out? (a) gives the page structure (b) lays out the page (c) makes headings and lists (d) makes a link
  16. 16.True or false: CSS adds space around boxes. (a) False (b) True
  17. 17.🖌️ How big is the text, in px?
    p {
      color: white;
      background-color: green;
      text-align: right;
      font-size: 20px;
    }
  18. 18.⚖️ What colour is the text of this element?
    <p class="star" id="end">Hi</p>
    CSS:
    #end { color: white; }
    #end { color: green; }
    (a) green (b) orange (c) yellow (d) white
  19. 19.⚖️ Which selector is the strongest? (a) an element selector (b) an id selector (c) a class selector
  20. 20.🔍 Which is the odd one out? (a) shows a pop-up message (b) adds space around boxes (c) lays out the page (d) changes the text size
  21. 21.🌈 In #rrggbb, which colour do the first two digits give? (a) blue (b) black (c) red (d) green
  22. 22.✍️ Which sign ends each CSS declaration? (a) ; (b) , (c) . (d) :
  23. 23.🧩 Which language adds space around boxes? (a) HTML (b) JavaScript (c) CSS
  24. 24.✍️ In color: blue; which part is the value? (a) color (b) : (c) ; (d) blue
  25. 25.🎯 Which CSS selector matches this element?
    <li class="note" id="logo">Hello</li>
    (a) li (b) .big (c) #end (d) #note
  26. 26.🌈 In #600000 the red part is the hex number 60. What is it as a normal number?
  27. 27.True or false: padding is the text or picture. (a) False (b) True
  28. 28.🌈 Which colour is #00ff00? (a) red (b) yellow (c) bright green (d) white
  29. 29.🌈 In #5b0000 the red part is the hex number 5b. What is it as a normal number?
  30. 30.🌈 In #000037 the blue part is the hex number 37. What is it as a normal number?
  31. 31.⚖️ What colour is the text of this element?
    <h1 class="note" id="logo">Hi</h1>
    CSS:
    .note { color: white; }
    h1 { color: black; }
    #logo { color: purple; }
    (a) black (b) purple (c) white (d) green
  32. 32.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 310px;
      justify-content: center;
    }
    Inside are 3 boxes, each 50px wide (no margins).
  33. 33.🌈 Which colour of light is strongest in rgb(32, 2, 167)? (a) green (b) blue (c) red
  34. 34.🔍 Which is the odd one out? (a) changes the page live (b) reacts to a button click (c) counts down a timer (d) adds space around boxes
  35. 35.🌈 Which colour is #00ffff? (a) yellow (b) cyan (c) bright green (d) black
  36. 36.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 18px;
      }
    }
    (a) No (b) Yes
  37. 37.Which of these does CSS do? (a) sets colours and fonts (b) makes a link (c) reacts to a button click (d) gives the page structure
  38. 38.🌈 Which colour is #000000? (a) yellow (b) magenta (c) black (d) cyan
  39. 39.✍️ Which sign goes between a property and its value? (a) ; (b) = (c) : (d) -
  40. 40.🎯 Which CSS selector matches this element?
    <h2 class="big" id="end">Hello</h2>
    (a) h2 (b) li (c) .end (d) .red

Answer key

  1. fits every screen
  2. flex-direction
  3. 102
  4. gives the page structure
  5. .
  6. <link>
  7. #ffff00
  8. 242
  9. 50
  10. space inside the border
  11. 1
  12. body
  13. many pages
  14. 26
  15. lays out the page
  16. True
  17. 20
  18. green
  19. an id selector
  20. shows a pop-up message
  21. red
  22. ;
  23. CSS
  24. blue
  25. li
  26. 96
  27. False
  28. bright green
  29. 91
  30. 55
  31. purple
  32. 80
  33. blue
  34. adds space around boxes
  35. cyan
  36. No
  37. sets colours and fonts
  38. black
  39. :
  40. h2

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