← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 536 · 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 behind the letters?
    h1 {
      text-align: center;
      font-size: 28px;
      color: green;
      background-color: orange;
    }
    (a) green (b) red (c) orange
  2. 2.🧩 Which language makes a link? (a) CSS (b) JavaScript (c) HTML
  3. 3.🌈 Which colour is rgb(255, 0, 0)? (a) white (b) red (c) cyan (d) black
  4. 4.✍️ In color: blue; which part is the value? (a) blue (b) : (c) color (d) ;
  5. 5.🎨 Which tag connects an outside CSS file? (a) <link> (b) <a> (c) <css> (d) <img>
  6. 6.✍️ Which sign ends each CSS declaration? (a) . (b) ; (c) : (d) ,
  7. 7.✍️ In color: blue; which part is the property? (a) : (b) blue (c) ; (d) color
  8. 8.What does justify-content: space-between do? (a) equal gaps, none at ends (b) packs boxes at the end (c) packs boxes at the start (d) puts boxes in the middle
  9. 9.True or false: margin is space outside the border. (a) False (b) True
  10. 10.📱 The screen is 700px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 12px;
      }
    }
    (a) Yes (b) No
  11. 11.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 250px;
      justify-content: flex-start;
    }
    Inside are 4 boxes, each 50px wide (no margins).
  12. 12.True or false: h1 is an element selector. (a) True (b) False
  13. 13.🧩 Which language adds space around boxes? (a) HTML (b) JavaScript (c) CSS
  14. 14.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 150px;
      padding: 20px;
      border: 1px solid black;
      margin: 5px;
    }
  15. 15.⚖️ What colour is the text of this element?
    <h1 class="big" id="intro">Hi</h1>
    CSS:
    #intro { color: blue; }
    #intro { color: purple; }
    (a) white (b) orange (c) purple (d) blue
  16. 16.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 18px;
      }
    }
  17. 17.What does font-size do? (a) sets the letter colour (b) centres a heading (c) makes letters bigger (d) colours behind the text
  18. 18.✍️ How many declarations (property: value pairs) are in this rule?
    .note {
      width: 300px;
      font-weight: bold;
      font-style: italic;
    }
  19. 19.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 22px;
      }
    }
  20. 20.🎯 Which element does the selector h2 style? (a) <li> (b) <div class="star"> (c) <span id="hero"> (d) <h2 class="star">
  21. 21.✍️ How many declarations (property: value pairs) are in this rule?
    li {
      font-size: 20px;
      color: red;
    }
  22. 22.🎯 What kind of selector is img? (a) a class selector (b) an id selector (c) an element selector
  23. 23.📱 The screen is 414px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 14px;
      }
    }
    (a) No (b) Yes
  24. 24.Which of these is margin? (a) the text or picture (b) a solid or dotted edge (c) the line round the box (d) the gap to other boxes
  25. 25.⚖️ What colour is the text of this element?
    <h2 class="star" id="intro">Hi</h2>
    CSS:
    h2 { color: yellow; }
    .star { color: orange; }
    (a) green (b) yellow (c) white (d) orange
  26. 26.🌈 In #rrggbb, which colour do the first two digits give? (a) green (b) black (c) red (d) blue
  27. 27.🎨 One CSS file can style how many pages? (a) only one image (b) only one word (c) no pages (d) many pages
  28. 28.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 240px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 100px wide (no margins).
  29. 29.🎯 Which element does the selector div style? (a) <h1 id="end"> (b) <div class="big"> (c) <p class="big"> (d) <span>
  30. 30.🧩 Which language changes the text size? (a) JavaScript (b) HTML (c) CSS
  31. 31.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 20px;
      }
    }
  32. 32.📱 What does a media query check? (a) the screen width (b) the battery level (c) the time of day (d) the page title
  33. 33.🌈 Which hex code is blue? (a) #0000ff (b) #000000 (c) #00ffff (d) #ff00ff
  34. 34.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 20px;
      }
    }
  35. 35.✍️ How many declarations (property: value pairs) are in this rule?
    body {
      background-color: yellow;
      width: 300px;
    }
  36. 36.🌈 Which colour is rgb(0, 0, 255)? (a) black (b) blue (c) cyan (d) bright green
  37. 37.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 8px;
      }
    }
  38. 38.🎯 Which element does the selector div style? (a) <h1 id="end"> (b) <p class="star"> (c) <div class="star"> (d) <span>
  39. 39.Which of these does HTML do? (a) adds space around boxes (b) shows a pop-up message (c) makes headings and lists (d) changes the text size
  40. 40.📱 Responsive design means a page ___. (a) never changes (b) is only for laptops (c) fits every screen (d) has no pictures

Answer key

  1. orange
  2. HTML
  3. red
  4. blue
  5. <link>
  6. ;
  7. color
  8. equal gaps, none at ends
  9. True
  10. No
  11. 50
  12. True
  13. CSS
  14. 202
  15. purple
  16. 18
  17. makes letters bigger
  18. 3
  19. 24
  20. <h2 class="star">
  21. 2
  22. an element selector
  23. Yes
  24. the gap to other boxes
  25. orange
  26. red
  27. many pages
  28. 40
  29. <div class="big">
  30. CSS
  31. 24
  32. the screen width
  33. #0000ff
  34. 20
  35. 2
  36. blue
  37. 12
  38. <div class="star">
  39. makes headings and lists
  40. fits every screen

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