← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 843 · 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.🖌️ Where does the text sit on its line?
    h1 {
      color: black;
      font-size: 20px;
      background-color: purple;
      text-align: center;
    }
    (a) on the left (b) in the middle (c) on the right
  2. 2.🌈 Which hex code is black? (a) #000000 (b) #0000ff (c) #ff00ff (d) #00ff00
  3. 3.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 14px;
      }
    }
  4. 4.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 10px;
      }
    }
  5. 5.✍️ How does a CSS comment start? (a) // (b) <!-- (c) # (d) /*
  6. 6.🌈 Which colour is rgb(255, 255, 255)? (a) magenta (b) bright green (c) red (d) white
  7. 7.⚖️ What colour is the text of this element?
    <p class="note" id="end">Hi</p>
    CSS:
    p { color: purple; }
    p { color: yellow; }
    (a) purple (b) yellow (c) green (d) white
  8. 8.🌈 In #rrggbb, which colour do the first two digits give? (a) blue (b) green (c) red (d) black
  9. 9.🖌️ What colour are the letters?
    h1 {
      text-align: center;
      font-size: 20px;
      background-color: orange;
      color: blue;
    }
    (a) blue (b) orange (c) white
  10. 10.✍️ What value is given to font-style in this rule?
    h1 {
      font-size: 20px;
      background-color: yellow;
      font-style: italic;
      color: red;
    }
    (a) italic (b) red (c) 20px (d) font-style
  11. 11.🎯 Which element does the selector li style? (a) <li class="big"> (b) <div> (c) <p id="end"> (d) <span class="big">
  12. 12.📱 Responsive design means a page ___. (a) never changes (b) has no pictures (c) is only for laptops (d) fits every screen
  13. 13.🧩 Which language makes a link? (a) JavaScript (b) HTML (c) CSS
  14. 14.🎯 Which CSS selector matches this element?
    <span class="box" id="hero">Hello</span>
    (a) #box (b) .star (c) .hero (d) span
  15. 15.⚖️ What colour is the text of this element?
    <h1 class="menu" id="main">Hi</h1>
    CSS:
    .menu { color: blue; }
    .menu { color: yellow; }
    (a) red (b) blue (c) green (d) yellow
  16. 16.✍️ How many declarations (property: value pairs) are in this rule?
    h1 {
      color: red;
      background-color: yellow;
      width: 300px;
      font-size: 20px;
    }
  17. 17.True or false: the border is a solid or dotted edge. (a) False (b) True
  18. 18.✍️ Which property is set to 2px solid in this rule?
    h1 {
      width: 300px;
      color: red;
      font-weight: bold;
      border: 2px solid;
    }
    (a) 2px solid (b) width (c) font-style (d) border
  19. 19.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 40px;
      padding: 30px;
      border: 4px solid black;
      margin: 10px;
    }
  20. 20.🎯 Which element does the selector span style? (a) <span class="note"> (b) <p> (c) <h2 id="main"> (d) <h1 class="note">
  21. 21.💪 Which flexbox property picks row or column? (a) align-items (b) display: flex (c) flex-direction (d) justify-content
  22. 22.✍️ In color: blue; which part is the property? (a) blue (b) ; (c) color (d) :
  23. 23.Which of these does CSS do? (a) checks a quiz answer (b) counts down a timer (c) sets colours and fonts (d) gives the page structure
  24. 24.⚖️ Which selector is the weakest? (a) a class selector (b) an id selector (c) an element selector
  25. 25.⚖️ What colour is the text of this element?
    <p class="menu" id="logo">Hi</p>
    CSS:
    p { color: blue; }
    .menu { color: purple; }
    #logo { color: orange; }
    (a) green (b) blue (c) purple (d) orange
  26. 26.Which of these does HTML do? (a) makes headings and lists (b) changes the page live (c) reacts to a button click (d) adds space around boxes
  27. 27.⚖️ What colour is the text of this element?
    <p class="big" id="hero">Hi</p>
    CSS:
    .big { color: red; }
    #hero { color: yellow; }
    p { color: green; }
    (a) red (b) orange (c) yellow (d) green
  28. 28.✍️ What is the selector in this CSS rule?
    h1 {
      margin: 10px;
      border: 2px solid;
      text-align: center;
    }
    (a) margin (b) 2px solid (c) p (d) h1
  29. 29.🌈 Which colour is #00ffff? (a) black (b) blue (c) bright green (d) cyan
  30. 30.🎯 What kind of selector is h1? (a) a class selector (b) an id selector (c) an element selector
  31. 31.🔍 Which is the odd one out? (a) makes headings and lists (b) counts down a timer (c) reacts to a button click (d) changes the page live
  32. 32.💪 Which justify-content value packs boxes at the start? (a) space-between (b) center (c) flex-start (d) flex-end
  33. 33.⚖️ What colour is the text of this element?
    <h2 class="box" id="top">Hi</h2>
    CSS:
    .box { color: orange; }
    h2 { color: purple; }
    #top { color: blue; }
    (a) green (b) purple (c) orange (d) blue
  34. 34.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 270px;
      justify-content: space-between;
    }
    Inside are 4 boxes, each 60px wide (no margins).
  35. 35.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 460px;
      justify-content: space-between;
    }
    Inside are 3 boxes, each 100px wide (no margins).
  36. 36.📱 The screen is 414px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 18px;
      }
    }
    (a) No (b) Yes
  37. 37.🌈 In #rrggbb, which colour do the last two digits give? (a) red (b) green (c) blue (d) white
  38. 38.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 8px;
      }
    }
  39. 39.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 410px;
      justify-content: space-between;
    }
    Inside are 4 boxes, each 80px wide (no margins).
  40. 40.📱 What does a media query check? (a) the page title (b) the battery level (c) the time of day (d) the screen width

Answer key

  1. in the middle
  2. #000000
  3. 12
  4. 16
  5. /*
  6. white
  7. yellow
  8. red
  9. blue
  10. italic
  11. <li class="big">
  12. fits every screen
  13. HTML
  14. span
  15. yellow
  16. 4
  17. True
  18. border
  19. 128
  20. <span class="note">
  21. flex-direction
  22. color
  23. sets colours and fonts
  24. an element selector
  25. orange
  26. makes headings and lists
  27. yellow
  28. h1
  29. cyan
  30. an element selector
  31. makes headings and lists
  32. flex-start
  33. blue
  34. 10
  35. 80
  36. No
  37. blue
  38. 12
  39. 30
  40. the screen width

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