← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 991 · 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.✍️ In color: blue; which part is the property? (a) blue (b) : (c) ; (d) color
  2. 2.True or false: #logo is a class selector. (a) False (b) True
  3. 3.🧩 Which language counts down a timer? (a) JavaScript (b) HTML (c) CSS
  4. 4.🎯 What kind of selector is .star? (a) a class selector (b) an element selector (c) an id selector
  5. 5.✍️ CSS declarations go inside which brackets? (a) < > (b) { } (c) [ ] (d) ( )
  6. 6.What does justify-content: flex-start do? (a) puts boxes in the middle (b) packs boxes at the start (c) equal gaps, none at ends (d) packs boxes at the end
  7. 7.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 290px;
      padding: 15px;
      border: 5px solid black;
      margin: 15px;
    }
  8. 8.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 130px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 60px wide (no margins).
  9. 9.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 130px;
      padding: 5px;
      border: 3px solid black;
      margin: 20px;
    }
  10. 10.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 14px;
      }
    }
  11. 11.⚖️ Which selector is the weakest? (a) a class selector (b) an id selector (c) an element selector
  12. 12.🎨 A CSS file usually ends with which extension? (a) .png (b) .html (c) .css (d) .js
  13. 13.True or false: the content is the text or picture. (a) True (b) False
  14. 14.🎯 What kind of selector is .note? (a) an element selector (b) an id selector (c) a class selector
  15. 15.True or false: CSS makes a form box. (a) False (b) True
  16. 16.📱 Responsive design means a page ___. (a) never changes (b) fits every screen (c) is only for laptops (d) has no pictures
  17. 17.⚖️ What colour is the text of this element?
    <h1 class="box" id="main">Hi</h1>
    CSS:
    .box { color: white; }
    #main { color: black; }
    h1 { color: green; }
    (a) green (b) blue (c) black (d) white
  18. 18.🎯 Which element does the selector .note style? (a) <li class="big"> (b) <li class="note"> (c) <li id="note"> (d) <div class="red">
  19. 19.True or false: JavaScript gives the page structure. (a) False (b) True
  20. 20.📦 In the box model, which part is space inside the border? (a) padding (b) content (c) margin (d) border
  21. 21.What does justify-content: flex-end do? (a) puts boxes in the middle (b) packs boxes at the start (c) packs boxes at the end (d) equal gaps, none at ends
  22. 22.✍️ What value is given to margin in this rule?
    h1 {
      font-style: italic;
      font-size: 20px;
      margin: 10px;
    }
    (a) 10px (b) margin (c) 8px (d) bold
  23. 23.True or false: CSS sets colours and fonts. (a) False (b) True
  24. 24.💪 Which flexbox property lines boxes up across? (a) align-items (b) justify-content (c) display: flex (d) flex-direction
  25. 25.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 20px;
      }
    }
  26. 26.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 130px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 50px wide (no margins).
  27. 27.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 90px;
      padding: 15px;
      border: 5px solid black;
      margin: 5px;
    }
  28. 28.🎯 How many elements on a page should have the same id? (a) 2 (b) any number (c) 1 (d) 5
  29. 29.✍️ Which property is set to 300px in this rule?
    .note {
      width: 300px;
      background-color: yellow;
    }
    (a) color (b) width (c) font-style (d) 300px
  30. 30.🌈 Which colour is #00ffff? (a) bright green (b) red (c) black (d) cyan
  31. 31.True or false: JavaScript makes headings and lists. (a) False (b) True
  32. 32.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 14px;
      }
    }
    (a) No (b) Yes
  33. 33.🔍 Which is the odd one out? (a) lays out the page (b) sets colours and fonts (c) rounds box corners (d) counts down a timer
  34. 34.What does font-family do? (a) colours behind the text (b) centres a heading (c) sets the letter colour (d) picks the font style
  35. 35.🌈 In #rrggbb, which colour do the last two digits give? (a) green (b) white (c) red (d) blue
  36. 36.✍️ What is the selector in this CSS rule?
    p {
      text-align: center;
      border: 2px solid;
    }
    (a) p (b) 2px solid (c) text-align (d) .note
  37. 37.🖌️ What colour is behind the letters?
    li {
      color: yellow;
      background-color: purple;
      text-align: left;
      font-size: 36px;
    }
    (a) purple (b) green (c) yellow
  38. 38.✍️ What is the selector in this CSS rule?
    li {
      width: 300px;
      border: 2px solid;
      text-align: center;
      background-color: yellow;
    }
    (a) 2px solid (b) body (c) width (d) li
  39. 39.🔍 Which is the odd one out? (a) makes a form box (b) puts a picture on a page (c) makes headings and lists (d) changes the page live
  40. 40.🌈 In #00f700 the green part is the hex number f7. What is it as a normal number?

Answer key

  1. color
  2. False
  3. JavaScript
  4. a class selector
  5. { }
  6. packs boxes at the start
  7. 330
  8. 10
  9. 146
  10. 20
  11. an element selector
  12. .css
  13. True
  14. a class selector
  15. False
  16. fits every screen
  17. black
  18. <li class="note">
  19. False
  20. padding
  21. packs boxes at the end
  22. 10px
  23. True
  24. align-items
  25. 24
  26. 30
  27. 140
  28. 1
  29. width
  30. cyan
  31. False
  32. Yes
  33. counts down a timer
  34. picks the font style
  35. blue
  36. p
  37. purple
  38. li
  39. changes the page live
  40. 247

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