← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 96 · 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.🖌️ Which CSS property sets the letter colour? (a) font-size (b) text-align (c) background-color (d) color
  2. 2.💪 Which justify-content value equal gaps, none at ends? (a) flex-start (b) flex-end (c) center (d) space-between
  3. 3.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 18px;
      }
    }
  4. 4.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 200px;
      padding: 30px;
      border: 5px solid black;
      margin: 10px;
    }
  5. 5.🎨 Which tag holds CSS inside the head? (a) <body> (b) <script> (c) <style> (d) <css>
  6. 6.⚖️ What colour is the text of this element?
    <h2 class="menu" id="main">Hi</h2>
    CSS:
    h2 { color: red; }
    h2 { color: orange; }
    (a) orange (b) red (c) black (d) blue
  7. 7.✍️ In color: blue; which part is the value? (a) ; (b) blue (c) : (d) color
  8. 8.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 12px;
      }
    }
    (a) No (b) Yes
  9. 9.⚖️ What colour is the text of this element?
    <h1 class="red" id="hero">Hi</h1>
    CSS:
    #hero { color: black; }
    #hero { color: orange; }
    (a) red (b) yellow (c) black (d) orange
  10. 10.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 110px;
      padding: 30px;
      border: 1px solid black;
      margin: 10px;
    }
  11. 11.🎯 Which CSS selector matches this element?
    <span class="star" id="main">Hello</span>
    (a) #star (b) #logo (c) #main (d) p
  12. 12.⚖️ What colour is the text of this element?
    <h1 class="menu" id="hero">Hi</h1>
    CSS:
    #hero { color: yellow; }
    #hero { color: red; }
    (a) white (b) red (c) black (d) yellow
  13. 13.📦 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: 2px solid black;
      margin: 15px;
    }
  14. 14.💪 Which flexbox property turns on flexbox? (a) display: flex (b) gap (c) align-items (d) justify-content
  15. 15.📦 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: 10px;
      border: 1px solid black;
      margin: 20px;
    }
  16. 16.⚖️ Which selector is the strongest? (a) an element selector (b) a class selector (c) an id selector
  17. 17.True or false: h1 is an element selector. (a) True (b) False
  18. 18.📱 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;
      }
    }
  19. 19.🎨 One CSS file can style how many pages? (a) only one word (b) many pages (c) only one image (d) no pages
  20. 20.📱 Responsive design means a page ___. (a) fits every screen (b) has no pictures (c) is only for laptops (d) never changes
  21. 21.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 14px;
      }
    }
  22. 22.True or false: .note is an element selector. (a) True (b) False
  23. 23.✍️ How does a CSS comment start? (a) <!-- (b) # (c) /* (d) //
  24. 24.True or false: HTML gives the page structure. (a) False (b) True
  25. 25.Which of these does JavaScript do? (a) adds space around boxes (b) makes headings and lists (c) counts down a timer (d) changes the text size
  26. 26.🧩 Which language gives the page structure? (a) CSS (b) JavaScript (c) HTML
  27. 27.What does background-color do? (a) sets the letter colour (b) makes the text bold (c) colours behind the text (d) centres a heading
  28. 28.What does color do? (a) picks the font style (b) makes the text bold (c) makes letters bigger (d) sets the letter colour
  29. 29.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 2 (b) 3 (c) 6 (d) 4
  30. 30.📦 In the box model, which part is the gap to other boxes? (a) padding (b) margin (c) border (d) content
  31. 31.True or false: .menu is an element selector. (a) True (b) False
  32. 32.📱 Which tag helps phones show a page at the right size? (a) the title tag (b) the viewport meta tag (c) the br tag (d) the hr tag
  33. 33.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 22px;
      }
    }
    (a) No (b) Yes
  34. 34.True or false: CSS adds space around boxes. (a) True (b) False
  35. 35.What does text-align do? (a) sets the letter colour (b) picks the font style (c) centres a heading (d) makes letters bigger
  36. 36.True or false: JavaScript rounds box corners. (a) False (b) True
  37. 37.⚖️ What colour is the text of this element?
    <p class="star" id="intro">Hi</p>
    CSS:
    #intro { color: yellow; }
    #intro { color: white; }
    (a) yellow (b) blue (c) white (d) purple
  38. 38.🖌️ Where does the text sit on its line?
    p {
      color: green;
      text-align: right;
      background-color: yellow;
      font-size: 16px;
    }
    (a) on the left (b) on the right (c) in the middle
  39. 39.✍️ Which property is set to 300px in this rule?
    body {
      padding: 8px;
      font-style: italic;
      font-size: 20px;
      width: 300px;
    }
    (a) font-style (b) width (c) 300px (d) color
  40. 40.True or false: img is an element selector. (a) False (b) True

Answer key

  1. color
  2. space-between
  3. 24
  4. 270
  5. <style>
  6. orange
  7. blue
  8. Yes
  9. orange
  10. 172
  11. #main
  12. red
  13. 324
  14. display: flex
  15. 152
  16. an id selector
  17. True
  18. 16
  19. many pages
  20. fits every screen
  21. 12
  22. False
  23. /*
  24. True
  25. counts down a timer
  26. HTML
  27. colours behind the text
  28. sets the letter colour
  29. 3
  30. margin
  31. False
  32. the viewport meta tag
  33. Yes
  34. True
  35. centres a heading
  36. False
  37. white
  38. on the right
  39. width
  40. True

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