← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 396 · 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.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 6px;
      }
    }
  2. 2.🌈 Which colour of light is strongest in rgb(162, 127, 132)? (a) red (b) blue (c) green
  3. 3.🖌️ Which CSS property sets the letter colour? (a) color (b) text-align (c) font-family (d) background-color
  4. 4.🖌️ What colour are the letters?
    h1 {
      font-size: 32px;
      text-align: left;
      color: red;
      background-color: purple;
    }
    (a) red (b) purple (c) black
  5. 5.📱 The screen is 700px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 28px;
      }
    }
    (a) No (b) Yes
  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: 180px;
      padding: 30px;
      border: 5px solid black;
      margin: 10px;
    }
  7. 7.🖌️ Where does the text sit on its line?
    h2 {
      font-size: 36px;
      background-color: purple;
      text-align: center;
      color: red;
    }
    (a) on the left (b) in the middle (c) on the right
  8. 8.⚖️ Which selector is the strongest? (a) an id selector (b) a class selector (c) an element selector
  9. 9.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 8px;
      }
    }
  10. 10.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 10px;
      }
    }
  11. 11.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 110px;
      padding: 20px;
      border: 5px solid black;
      margin: 15px;
    }
  12. 12.🌈 Hex digits go 0 to 9, then A to which letter? (a) J (b) Z (c) G (d) F
  13. 13.✍️ What value is given to color in this rule?
    #top {
      color: red;
      font-style: italic;
    }
    (a) color (b) red (c) center (d) 20px
  14. 14.📦 In the box model, which part is a solid or dotted edge? (a) padding (b) border (c) content (d) margin
  15. 15.📦 In the box model, which part is the line round the box? (a) padding (b) content (c) margin (d) border
  16. 16.True or false: the content is space inside the border. (a) True (b) False
  17. 17.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 6px;
      }
    }
  18. 18.✍️ What value is given to font-size in this rule?
    body {
      border: 2px solid;
      font-size: 20px;
    }
    (a) font-size (b) center (c) 20px (d) yellow
  19. 19.True or false: CSS lays out the page. (a) True (b) False
  20. 20.Which of these does HTML do? (a) sets colours and fonts (b) checks a quiz answer (c) changes the text size (d) makes headings and lists
  21. 21.🎯 How many elements on a page should have the same id? (a) any number (b) 1 (c) 2 (d) 5
  22. 22.What does justify-content: center do? (a) packs boxes at the start (b) equal gaps, none at ends (c) packs boxes at the end (d) puts boxes in the middle
  23. 23.Which of these does JavaScript do? (a) adds space around boxes (b) lays out the page (c) reacts to a button click (d) sets colours and fonts
  24. 24.True or false: p is an id selector. (a) True (b) False
  25. 25.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 26px;
      }
    }
  26. 26.📱 The screen is 700px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 32px;
      }
    }
    (a) Yes (b) No
  27. 27.🧩 Which language sets colours and fonts? (a) HTML (b) JavaScript (c) CSS
  28. 28.⚖️ What colour is the text of this element?
    <p class="red" id="end">Hi</p>
    CSS:
    .red { color: red; }
    #end { color: purple; }
    p { color: green; }
    (a) red (b) green (c) black (d) purple
  29. 29.🌈 Which colour of light is strongest in rgb(48, 109, 197)? (a) red (b) green (c) blue
  30. 30.🖌️ Where does the text sit on its line?
    li {
      color: purple;
      text-align: right;
      background-color: black;
      font-size: 20px;
    }
    (a) on the left (b) in the middle (c) on the right
  31. 31.💪 Which justify-content value packs boxes at the start? (a) flex-start (b) space-between (c) flex-end (d) center
  32. 32.🖌️ What colour is behind the letters?
    h2 {
      color: red;
      text-align: center;
      background-color: yellow;
      font-size: 12px;
    }
    (a) red (b) white (c) yellow
  33. 33.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 180px;
      padding: 10px;
      border: 1px solid black;
      margin: 5px;
    }
  34. 34.✍️ What value is given to border in this rule?
    h1 {
      color: red;
      border: 2px solid;
    }
    (a) 2px solid (b) border (c) 300px (d) italic
  35. 35.📱 The screen is 1100px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 20px;
      }
    }
    (a) Yes (b) No
  36. 36.🎯 Which CSS selector matches this element?
    <span class="star" id="top">Hello</span>
    (a) #top (b) #intro (c) #star (d) .top
  37. 37.✍️ How many declarations (property: value pairs) are in this rule?
    p {
      background-color: yellow;
      width: 300px;
      color: red;
      border: 2px solid;
    }
  38. 38.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 12px;
      }
    }
  39. 39.🧩 Which language makes a link? (a) JavaScript (b) CSS (c) HTML
  40. 40.🎯 What kind of selector is h1? (a) a class selector (b) an id selector (c) an element selector

Answer key

  1. 12
  2. red
  3. color
  4. red
  5. Yes
  6. 250
  7. in the middle
  8. an id selector
  9. 8
  10. 16
  11. 190
  12. F
  13. red
  14. border
  15. border
  16. False
  17. 6
  18. 20px
  19. True
  20. makes headings and lists
  21. 1
  22. puts boxes in the middle
  23. reacts to a button click
  24. False
  25. 20
  26. No
  27. CSS
  28. purple
  29. blue
  30. on the right
  31. flex-start
  32. yellow
  33. 202
  34. 2px solid
  35. Yes
  36. #top
  37. 4
  38. 16
  39. HTML
  40. an element selector

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