← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 346 · 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.True or false: .card is an id selector. (a) True (b) False
  2. 2.🎯 Which sign starts a class selector? (a) # (b) @ (c) . (d) &
  3. 3.📱 The screen is 1100px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 14px;
      }
    }
    (a) Yes (b) No
  4. 4.✍️ How many declarations (property: value pairs) are in this rule?
    p {
      font-style: italic;
      padding: 8px;
    }
  5. 5.🌈 Which hex code is black? (a) #ff00ff (b) #00ff00 (c) #ffff00 (d) #000000
  6. 6.📦 In the box model, which part is space outside the border? (a) content (b) padding (c) border (d) margin
  7. 7.🎨 What does CSS stand for? (a) Cascading Style Sheets (b) Computer Style Sheets (c) Colourful Site Styles (d) Creative Sheet System
  8. 8.📱 Responsive design means a page ___. (a) has no pictures (b) never changes (c) fits every screen (d) is only for laptops
  9. 9.🎯 Which CSS selector matches this element?
    <p class="menu" id="hero">Hello</p>
    (a) #menu (b) .note (c) #top (d) .menu
  10. 10.⚖️ What colour is the text of this element?
    <h1 class="big" id="logo">Hi</h1>
    CSS:
    .big { color: black; }
    h1 { color: blue; }
    (a) red (b) blue (c) black (d) yellow
  11. 11.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 18px;
      }
    }
  12. 12.🎯 What kind of selector is #top? (a) a class selector (b) an element selector (c) an id selector
  13. 13.📱 max-width: 600px applies when the screen is ___. (a) 600px or wider (b) turned off (c) 600px or narrower (d) exactly 1000px
  14. 14.🎯 What kind of selector is img? (a) an id selector (b) a class selector (c) an element selector
  15. 15.🌈 In #rrggbb, which colour do the first two digits give? (a) green (b) red (c) blue (d) black
  16. 16.💪 Which flexbox property lines boxes up across? (a) align-items (b) justify-content (c) display: flex (d) gap
  17. 17.Which of these does JavaScript do? (a) makes a link (b) reacts to a button click (c) makes headings and lists (d) rounds box corners
  18. 18.🌈 Which colour is rgb(255, 0, 0)? (a) magenta (b) cyan (c) bright green (d) red
  19. 19.What does background-color do? (a) picks the font style (b) sets the letter colour (c) colours behind the text (d) centres a heading
  20. 20.📦 In the box model, which part is the line round the box? (a) padding (b) border (c) margin (d) content
  21. 21.📱 The screen is 1366px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 14px;
      }
    }
    (a) Yes (b) No
  22. 22.True or false: JavaScript makes a form box. (a) False (b) True
  23. 23.🎨 Which tag holds CSS inside the head? (a) <script> (b) <style> (c) <css> (d) <body>
  24. 24.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 260px;
      padding: 10px;
      border: 4px solid black;
      margin: 15px;
    }
  25. 25.⚖️ Which selector is the strongest? (a) an element selector (b) a class selector (c) an id selector
  26. 26.🌈 Which colour of light is strongest in rgb(236, 4, 37)? (a) green (b) blue (c) red
  27. 27.🖌️ What colour are the letters?
    h1 {
      text-align: left;
      background-color: purple;
      color: red;
      font-size: 28px;
    }
    (a) black (b) red (c) purple
  28. 28.🖌️ Which CSS property sets the letter colour? (a) background-color (b) color (c) font-weight (d) font-size
  29. 29.🎯 Which CSS selector matches this element?
    <span class="note" id="end">Hello</span>
    (a) .big (b) #end (c) .end (d) #hero
  30. 30.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 80px;
      padding: 15px;
      border: 1px solid black;
      margin: 15px;
    }
  31. 31.🌈 Which colour is #ffff00? (a) black (b) white (c) bright green (d) yellow
  32. 32.🎯 What kind of selector is body? (a) a class selector (b) an id selector (c) an element selector
  33. 33.🖌️ Which CSS property centres a heading? (a) text-align (b) font-family (c) font-weight (d) font-size
  34. 34.🎯 What kind of selector is .star? (a) a class selector (b) an id selector (c) an element selector
  35. 35.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 14px;
      }
    }
    (a) Yes (b) No
  36. 36.⚖️ Which selector is the weakest? (a) an element selector (b) an id selector (c) a class selector
  37. 37.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 200px;
      padding: 30px;
      border: 1px solid black;
      margin: 15px;
    }
  38. 38.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 420px;
      justify-content: space-between;
    }
    Inside are 3 boxes, each 100px wide (no margins).
  39. 39.🧩 Which language makes a link? (a) JavaScript (b) CSS (c) HTML
  40. 40.📱 The screen is 820px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 28px;
      }
    }
    (a) No (b) Yes

Answer key

  1. False
  2. .
  3. No
  4. 2
  5. #000000
  6. margin
  7. Cascading Style Sheets
  8. fits every screen
  9. .menu
  10. black
  11. 24
  12. an id selector
  13. 600px or narrower
  14. an element selector
  15. red
  16. align-items
  17. reacts to a button click
  18. red
  19. colours behind the text
  20. border
  21. Yes
  22. False
  23. <style>
  24. 318
  25. an id selector
  26. red
  27. red
  28. color
  29. #end
  30. 142
  31. yellow
  32. an element selector
  33. text-align
  34. a class selector
  35. No
  36. an element selector
  37. 292
  38. 60
  39. HTML
  40. Yes

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