← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 147 · 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 the text of this element?
    <h1 class="star" id="end">Hi</h1>
    CSS:
    h1 { color: red; }
    .star { color: white; }
    #end { color: yellow; }
    (a) red (b) yellow (c) blue (d) white
  2. 2.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 6px;
      }
    }
  3. 3.🎯 Which element does the selector .box style? (a) <h1 class="menu"> (b) <p id="box"> (c) <p class="star"> (d) <p class="box">
  4. 4.What does color do? (a) picks the font style (b) centres a heading (c) sets the letter colour (d) makes the text bold
  5. 5.⚖️ What colour is the text of this element?
    <h1 class="note" id="end">Hi</h1>
    CSS:
    #end { color: black; }
    #end { color: yellow; }
    (a) black (b) green (c) yellow (d) blue
  6. 6.🌈 Which colour of light is strongest in rgb(29, 219, 115)? (a) green (b) red (c) blue
  7. 7.✍️ How does a CSS comment start? (a) # (b) // (c) <!-- (d) /*
  8. 8.🖌️ What colour are the letters?
    li {
      font-size: 12px;
      background-color: blue;
      color: green;
      text-align: right;
    }
    (a) blue (b) white (c) green
  9. 9.🌈 Which hex code is cyan? (a) #00ff00 (b) #00ffff (c) #ff0000 (d) #000000
  10. 10.🌈 In #910000 the red part is the hex number 91. What is it as a normal number?
  11. 11.⚖️ What colour is the text of this element?
    <h1 class="menu" id="logo">Hi</h1>
    CSS:
    h1 { color: purple; }
    h1 { color: white; }
    (a) yellow (b) white (c) purple (d) orange
  12. 12.💪 Which flexbox property turns on flexbox? (a) align-items (b) display: flex (c) justify-content (d) gap
  13. 13.⚖️ What colour is the text of this element?
    <p class="menu" id="top">Hi</p>
    CSS:
    p { color: white; }
    p { color: black; }
    (a) red (b) white (c) orange (d) black
  14. 14.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 24px;
      }
    }
  15. 15.✍️ How many declarations (property: value pairs) are in this rule?
    h1 {
      background-color: yellow;
      font-size: 20px;
    }
  16. 16.Which of these does HTML do? (a) puts a picture on a page (b) sets colours and fonts (c) adds space around boxes (d) reacts to a button click
  17. 17.✍️ How many declarations (property: value pairs) are in this rule?
    p {
      background-color: yellow;
    }
  18. 18.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 24px;
      }
    }
  19. 19.⚖️ What colour is the text of this element?
    <p class="star" id="top">Hi</p>
    CSS:
    .star { color: orange; }
    .star { color: red; }
    (a) orange (b) green (c) red (d) yellow
  20. 20.✍️ What is the selector in this CSS rule?
    p {
      width: 300px;
      text-align: center;
      padding: 8px;
      background-color: yellow;
    }
    (a) p (b) center (c) width (d) .note
  21. 21.Which of these does HTML do? (a) reacts to a button click (b) counts down a timer (c) gives the page structure (d) shows a pop-up message
  22. 22.✍️ In color: blue; which part is the value? (a) : (b) ; (c) color (d) blue
  23. 23.📦 In the box model, which part is the text or picture? (a) margin (b) content (c) border (d) padding
  24. 24.🎯 Which CSS selector matches this element?
    <p class="star" id="intro">Hello</p>
    (a) .star (b) .menu (c) #star (d) h1
  25. 25.💪 Which flexbox property lines boxes up across? (a) flex-direction (b) justify-content (c) display: flex (d) align-items
  26. 26.💪 Which flexbox property picks row or column? (a) display: flex (b) justify-content (c) flex-direction (d) align-items
  27. 27.🔍 Which is the odd one out? (a) sets colours and fonts (b) checks a quiz answer (c) rounds box corners (d) changes the text size
  28. 28.What does background-color do? (a) colours behind the text (b) centres a heading (c) sets the letter colour (d) makes letters bigger
  29. 29.⚖️ What colour is the text of this element?
    <h1 class="star" id="top">Hi</h1>
    CSS:
    #top { color: black; }
    #top { color: blue; }
    (a) orange (b) black (c) white (d) blue
  30. 30.✍️ How many declarations (property: value pairs) are in this rule?
    .note {
      padding: 8px;
      background-color: yellow;
    }
  31. 31.⚖️ Which selector is the weakest? (a) an id selector (b) a class selector (c) an element selector
  32. 32.🧩 Which language lays out the page? (a) HTML (b) JavaScript (c) CSS
  33. 33.📱 Which tag helps phones show a page at the right size? (a) the hr tag (b) the viewport meta tag (c) the br tag (d) the title tag
  34. 34.True or false: li is an element selector. (a) True (b) False
  35. 35.True or false: the content is space inside the border. (a) False (b) True
  36. 36.🖌️ Which CSS property makes the text bold? (a) background-color (b) text-align (c) font-weight (d) color
  37. 37.✍️ What value is given to padding in this rule?
    .box {
      width: 300px;
      font-size: 20px;
      text-align: center;
      padding: 8px;
    }
    (a) 8px (b) padding (c) 2px solid (d) bold
  38. 38.📱 The screen is 1366px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 14px;
      }
    }
    (a) No (b) Yes
  39. 39.🎯 Which element does the selector li style? (a) <div> (b) <span class="box"> (c) <p id="intro"> (d) <li class="box">
  40. 40.🔍 Which is the odd one out? (a) makes a link (b) makes headings and lists (c) sets colours and fonts (d) makes a form box

Answer key

  1. yellow
  2. 12
  3. <p class="box">
  4. sets the letter colour
  5. yellow
  6. green
  7. /*
  8. green
  9. #00ffff
  10. 145
  11. white
  12. display: flex
  13. black
  14. 20
  15. 2
  16. puts a picture on a page
  17. 1
  18. 16
  19. red
  20. p
  21. gives the page structure
  22. blue
  23. content
  24. .star
  25. align-items
  26. flex-direction
  27. checks a quiz answer
  28. colours behind the text
  29. blue
  30. 2
  31. an element selector
  32. CSS
  33. the viewport meta tag
  34. True
  35. False
  36. font-weight
  37. 8px
  38. Yes
  39. <li class="box">
  40. sets colours and fonts

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