← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 873 · 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 value is given to text-align in this rule?
    h1 {
      text-align: center;
      width: 300px;
    }
    (a) text-align (b) center (c) 10px (d) yellow
  2. 2.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 320px;
      justify-content: center;
    }
    Inside are 3 boxes, each 60px wide (no margins).
  3. 3.True or false: JavaScript counts down a timer. (a) True (b) False
  4. 4.🎯 Which sign starts a class selector? (a) . (b) # (c) @ (d) &
  5. 5.🎯 Can many elements share the same class? (a) No (b) Yes
  6. 6.⚖️ What colour is the text of this element?
    <h1 class="menu" id="main">Hi</h1>
    CSS:
    #main { color: purple; }
    #main { color: white; }
    (a) green (b) orange (c) purple (d) white
  7. 7.🎨 Which attribute adds CSS inside one tag? (a) alt (b) src (c) style (d) href
  8. 8.⚖️ What colour is the text of this element?
    <p class="note" id="end">Hi</p>
    CSS:
    p { color: purple; }
    p { color: red; }
    (a) black (b) purple (c) red (d) orange
  9. 9.📱 The screen is 414px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 20px;
      }
    }
    (a) Yes (b) No
  10. 10.⚖️ What colour is the text of this element?
    <h2 class="menu" id="top">Hi</h2>
    CSS:
    h2 { color: yellow; }
    .menu { color: blue; }
    (a) orange (b) blue (c) yellow (d) white
  11. 11.📱 The screen is 820px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 26px;
      }
    }
    (a) No (b) Yes
  12. 12.💪 Which flexbox property lines boxes up across? (a) flex-direction (b) display: flex (c) align-items (d) justify-content
  13. 13.Which of these does JavaScript do? (a) adds space around boxes (b) changes the text size (c) reacts to a button click (d) rounds box corners
  14. 14.✍️ Which property is set to bold in this rule?
    li {
      background-color: yellow;
      font-weight: bold;
      width: 300px;
    }
    (a) border (b) bold (c) font-weight (d) width
  15. 15.🎯 How many elements on a page should have the same id? (a) any number (b) 2 (c) 1 (d) 5
  16. 16.✍️ How many declarations (property: value pairs) are in this rule?
    li {
      font-style: italic;
      padding: 8px;
      margin: 10px;
      background-color: yellow;
    }
  17. 17.🎯 Which CSS selector matches this element?
    <h2 class="box" id="top">Hello</h2>
    (a) #box (b) h2 (c) .top (d) li
  18. 18.🧩 Which language changes the page live? (a) CSS (b) HTML (c) JavaScript
  19. 19.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 14px;
      }
    }
  20. 20.🖌️ Which CSS property colours behind the text? (a) background-color (b) color (c) text-align (d) font-weight
  21. 21.✍️ In color: blue; which part is the property? (a) : (b) blue (c) color (d) ;
  22. 22.🔍 Which is the odd one out? (a) makes headings and lists (b) gives the page structure (c) reacts to a button click (d) makes a link
  23. 23.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 210px;
      padding: 10px;
      border: 4px solid black;
      margin: 20px;
    }
  24. 24.✍️ How many declarations (property: value pairs) are in this rule?
    h2 {
      background-color: yellow;
      font-weight: bold;
      text-align: center;
      font-size: 20px;
    }
  25. 25.✍️ What is the selector in this CSS rule?
    .box {
      margin: 10px;
      border: 2px solid;
      background-color: yellow;
      padding: 8px;
    }
    (a) h2 (b) margin (c) 2px solid (d) .box
  26. 26.True or false: .star is an element selector. (a) True (b) False
  27. 27.✍️ Which sign ends each CSS declaration? (a) . (b) ; (c) : (d) ,
  28. 28.🖌️ Which CSS property centres a heading? (a) font-size (b) text-align (c) font-weight (d) background-color
  29. 29.⚖️ What colour is the text of this element?
    <h2 class="big" id="end">Hi</h2>
    CSS:
    .big { color: orange; }
    #end { color: blue; }
    (a) blue (b) red (c) green (d) orange
  30. 30.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 110px;
      padding: 25px;
      border: 2px solid black;
      margin: 5px;
    }
  31. 31.⚖️ What colour is the text of this element?
    <h1 class="big" id="intro">Hi</h1>
    CSS:
    #intro { color: blue; }
    #intro { color: green; }
    (a) black (b) green (c) blue (d) orange
  32. 32.🎯 Which CSS selector matches this element?
    <li class="big" id="hero">Hello</li>
    (a) #top (b) div (c) .red (d) #hero
  33. 33.✍️ How many declarations (property: value pairs) are in this rule?
    .box {
      font-style: italic;
      font-weight: bold;
      background-color: yellow;
      border: 2px solid;
    }
  34. 34.⚖️ What colour is the text of this element?
    <p class="menu" id="top">Hi</p>
    CSS:
    .menu { color: red; }
    p { color: purple; }
    #top { color: green; }
    (a) red (b) green (c) white (d) purple
  35. 35.🔍 Which is the odd one out? (a) checks a quiz answer (b) puts a picture on a page (c) makes headings and lists (d) makes a link
  36. 36.✍️ How does a CSS comment start? (a) <!-- (b) // (c) /* (d) #
  37. 37.📱 The screen is 820px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 26px;
      }
    }
    (a) Yes (b) No
  38. 38.Which of these does JavaScript do? (a) changes the text size (b) checks a quiz answer (c) makes a link (d) adds space around boxes
  39. 39.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 26px;
      }
    }
  40. 40.🖌️ What colour is behind the letters?
    h2 {
      font-size: 20px;
      background-color: red;
      color: white;
      text-align: left;
    }
    (a) white (b) red (c) blue

Answer key

  1. center
  2. 70
  3. True
  4. .
  5. Yes
  6. white
  7. style
  8. red
  9. No
  10. blue
  11. No
  12. align-items
  13. reacts to a button click
  14. font-weight
  15. 1
  16. 4
  17. h2
  18. JavaScript
  19. 14
  20. background-color
  21. color
  22. reacts to a button click
  23. 238
  24. 4
  25. .box
  26. False
  27. ;
  28. text-align
  29. blue
  30. 174
  31. green
  32. #hero
  33. 4
  34. green
  35. checks a quiz answer
  36. /*
  37. Yes
  38. checks a quiz answer
  39. 24
  40. red

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