← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 492 · 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="box" id="hero">Hi</h1>
    CSS:
    #hero { color: green; }
    #hero { color: purple; }
    (a) green (b) blue (c) purple (d) black
  2. 2.🖌️ Where does the text sit on its line?
    p {
      color: red;
      background-color: yellow;
      font-size: 28px;
      text-align: center;
    }
    (a) on the left (b) on the right (c) in the middle
  3. 3.🧩 Which language sets colours and fonts? (a) HTML (b) CSS (c) JavaScript
  4. 4.True or false: the content is the text or picture. (a) True (b) False
  5. 5.🌈 Which colour of light is strongest in rgb(14, 186, 119)? (a) red (b) blue (c) green
  6. 6.✍️ How many declarations (property: value pairs) are in this rule?
    h2 {
      color: red;
    }
  7. 7.⚖️ What colour is the text of this element?
    <h2 class="note" id="main">Hi</h2>
    CSS:
    .note { color: red; }
    #main { color: blue; }
    (a) red (b) orange (c) purple (d) blue
  8. 8.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 40px;
      padding: 20px;
      border: 2px solid black;
      margin: 0px;
    }
  9. 9.Which of these does HTML do? (a) gives the page structure (b) lays out the page (c) adds space around boxes (d) checks a quiz answer
  10. 10.📦 In the box model, which part is the line round the box? (a) padding (b) margin (c) border (d) content
  11. 11.📱 The screen is 1100px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 16px;
      }
    }
    (a) No (b) Yes
  12. 12.True or false: margin is the gap to other boxes. (a) True (b) False
  13. 13.🌈 In #rrggbb, which colour do the last two digits give? (a) green (b) red (c) white (d) blue
  14. 14.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 18px;
      }
    }
  15. 15.✍️ How many declarations (property: value pairs) are in this rule?
    li {
      color: red;
    }
  16. 16.✍️ CSS declarations go inside which brackets? (a) < > (b) [ ] (c) { } (d) ( )
  17. 17.⚖️ Which selector is the weakest? (a) a class selector (b) an element selector (c) an id selector
  18. 18.💪 Which flexbox property lines boxes up across? (a) display: flex (b) align-items (c) flex-direction (d) gap
  19. 19.🎯 What kind of selector is #top? (a) an element selector (b) an id selector (c) a class selector
  20. 20.✍️ In color: blue; which part is the property? (a) blue (b) : (c) ; (d) color
  21. 21.🖌️ Which CSS property centres a heading? (a) font-size (b) color (c) font-family (d) text-align
  22. 22.✍️ How many declarations (property: value pairs) are in this rule?
    #top {
      border: 2px solid;
      background-color: yellow;
      color: red;
      font-size: 20px;
    }
  23. 23.🖌️ How big is the text, in px?
    h1 {
      background-color: red;
      text-align: center;
      color: green;
      font-size: 24px;
    }
  24. 24.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 270px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 100px wide (no margins).
  25. 25.True or false: #logo is an id selector. (a) True (b) False
  26. 26.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 18px;
      }
    }
    (a) No (b) Yes
  27. 27.True or false: margin is the gap round content. (a) True (b) False
  28. 28.✍️ How many declarations (property: value pairs) are in this rule?
    li {
      border: 2px solid;
      background-color: yellow;
    }
  29. 29.What does color do? (a) centres a heading (b) colours behind the text (c) sets the letter colour (d) makes letters bigger
  30. 30.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 60px;
      padding: 30px;
      border: 1px solid black;
      margin: 0px;
    }
  31. 31.✍️ In color: blue; which part is the value? (a) color (b) ; (c) blue (d) :
  32. 32.Which of these is the content? (a) a solid or dotted edge (b) space inside the border (c) space outside the border (d) the text or picture
  33. 33.🧩 Which language gives the page structure? (a) JavaScript (b) HTML (c) CSS
  34. 34.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 8px;
      }
    }
  35. 35.🎨 One CSS file can style how many pages? (a) no pages (b) only one image (c) many pages (d) only one word
  36. 36.What does text-align do? (a) colours behind the text (b) centres a heading (c) makes letters bigger (d) makes the text bold
  37. 37.📱 Which tag helps phones show a page at the right size? (a) the hr tag (b) the viewport meta tag (c) the br tag (d) the title tag
  38. 38.🌈 In #e80000 the red part is the hex number e8. What is it as a normal number?
  39. 39.⚖️ What colour is the text of this element?
    <h2 class="big" id="intro">Hi</h2>
    CSS:
    h2 { color: yellow; }
    h2 { color: red; }
    (a) blue (b) red (c) black (d) yellow
  40. 40.🖌️ Which CSS property sets the letter colour? (a) font-weight (b) font-family (c) font-size (d) color

Answer key

  1. purple
  2. in the middle
  3. CSS
  4. True
  5. green
  6. 1
  7. blue
  8. 84
  9. gives the page structure
  10. border
  11. Yes
  12. True
  13. blue
  14. 20
  15. 1
  16. { }
  17. an element selector
  18. align-items
  19. an id selector
  20. color
  21. text-align
  22. 4
  23. 24
  24. 70
  25. True
  26. Yes
  27. False
  28. 2
  29. sets the letter colour
  30. 122
  31. blue
  32. the text or picture
  33. HTML
  34. 8
  35. many pages
  36. centres a heading
  37. the viewport meta tag
  38. 232
  39. red
  40. color

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