← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 638 · 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.🎯 Which CSS selector matches this element?
    <span class="menu" id="main">Hello</span>
    (a) #logo (b) p (c) #menu (d) span
  2. 2.🖌️ Which CSS property picks the font style? (a) font-weight (b) text-align (c) font-family (d) font-size
  3. 3.💪 Which justify-content value packs boxes at the start? (a) flex-end (b) space-between (c) flex-start (d) center
  4. 4.✍️ What value is given to border in this rule?
    li {
      margin: 10px;
      border: 2px solid;
      color: red;
    }
    (a) italic (b) border (c) 300px (d) 2px solid
  5. 5.Which of these does HTML do? (a) shows a pop-up message (b) counts down a timer (c) reacts to a button click (d) makes headings and lists
  6. 6.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 370px;
      justify-content: flex-start;
    }
    Inside are 4 boxes, each 80px wide (no margins).
  7. 7.🌈 In #0000c3 the blue part is the hex number c3. What is it as a normal number?
  8. 8.What does background-color do? (a) colours behind the text (b) sets the letter colour (c) makes letters bigger (d) makes the text bold
  9. 9.🖌️ Which CSS property sets the letter colour? (a) color (b) background-color (c) font-weight (d) font-size
  10. 10.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 320px;
      justify-content: center;
    }
    Inside are 3 boxes, each 100px wide (no margins).
  11. 11.🌈 In #rrggbb, which colour do the first two digits give? (a) red (b) blue (c) green (d) black
  12. 12.⚖️ What colour is the text of this element?
    <p class="box" id="logo">Hi</p>
    CSS:
    p { color: red; }
    .box { color: orange; }
    (a) blue (b) black (c) orange (d) red
  13. 13.🔍 Which is the odd one out? (a) makes a link (b) sets colours and fonts (c) puts a picture on a page (d) makes headings and lists
  14. 14.✍️ How many declarations (property: value pairs) are in this rule?
    body {
      font-size: 20px;
      background-color: yellow;
    }
  15. 15.🧩 Which language gives the page structure? (a) JavaScript (b) CSS (c) HTML
  16. 16.🧩 Which language puts a picture on a page? (a) JavaScript (b) HTML (c) CSS
  17. 17.✍️ What value is given to margin in this rule?
    body {
      font-size: 20px;
      text-align: center;
      margin: 10px;
    }
    (a) 8px (b) margin (c) bold (d) 10px
  18. 18.🖌️ Which CSS property centres a heading? (a) color (b) background-color (c) font-size (d) text-align
  19. 19.📱 The screen is 414px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 10px;
      }
    }
    (a) No (b) Yes
  20. 20.🖌️ Where does the text sit on its line?
    li {
      font-size: 28px;
      color: white;
      background-color: orange;
      text-align: center;
    }
    (a) in the middle (b) on the left (c) on the right
  21. 21.⚖️ Which selector is the weakest? (a) an element selector (b) a class selector (c) an id selector
  22. 22.✍️ What value is given to width in this rule?
    body {
      font-size: 20px;
      background-color: yellow;
      width: 300px;
      border: 2px solid;
    }
    (a) red (b) width (c) italic (d) 300px
  23. 23.💪 Which flexbox property sets space between boxes? (a) flex-direction (b) justify-content (c) gap (d) display: flex
  24. 24.✍️ What value is given to font-size in this rule?
    h2 {
      font-size: 20px;
      border: 2px solid;
      margin: 10px;
    }
    (a) 20px (b) center (c) yellow (d) font-size
  25. 25.True or false: .card is an id selector. (a) False (b) True
  26. 26.✍️ In color: blue; which part is the property? (a) ; (b) blue (c) : (d) color
  27. 27.True or false: #top is an element selector. (a) True (b) False
  28. 28.True or false: HTML checks a quiz answer. (a) False (b) True
  29. 29.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 160px;
      justify-content: space-between;
    }
    Inside are 2 boxes, each 60px wide (no margins).
  30. 30.✍️ How many declarations (property: value pairs) are in this rule?
    .note {
      color: red;
    }
  31. 31.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 20px;
      }
    }
  32. 32.Which of these does JavaScript do? (a) adds space around boxes (b) makes a form box (c) puts a picture on a page (d) counts down a timer
  33. 33.⚖️ What colour is the text of this element?
    <p class="big" id="top">Hi</p>
    CSS:
    p { color: yellow; }
    p { color: black; }
    (a) yellow (b) blue (c) red (d) black
  34. 34.🖌️ What colour are the letters?
    h1 {
      background-color: blue;
      font-size: 12px;
      text-align: right;
      color: green;
    }
    (a) orange (b) blue (c) green
  35. 35.🖌️ What colour is behind the letters?
    h1 {
      color: blue;
      font-size: 32px;
      background-color: green;
      text-align: left;
    }
    (a) blue (b) green (c) orange
  36. 36.🎯 Which sign starts an id selector? (a) # (b) . (c) & (d) @
  37. 37.What does text-align do? (a) centres a heading (b) sets the letter colour (c) picks the font style (d) makes letters bigger
  38. 38.🌈 Which hex code is blue? (a) #0000ff (b) #ff0000 (c) #ffff00 (d) #000000
  39. 39.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 200px;
      justify-content: center;
    }
    Inside are 2 boxes, each 80px wide (no margins).
  40. 40.⚖️ Which selector is the strongest? (a) an element selector (b) an id selector (c) a class selector

Answer key

  1. span
  2. font-family
  3. flex-start
  4. 2px solid
  5. makes headings and lists
  6. 50
  7. 195
  8. colours behind the text
  9. color
  10. 10
  11. red
  12. orange
  13. sets colours and fonts
  14. 2
  15. HTML
  16. HTML
  17. 10px
  18. text-align
  19. Yes
  20. in the middle
  21. an element selector
  22. 300px
  23. gap
  24. 20px
  25. False
  26. color
  27. False
  28. False
  29. 40
  30. 1
  31. 20
  32. counts down a timer
  33. black
  34. green
  35. green
  36. #
  37. centres a heading
  38. #0000ff
  39. 20
  40. an id selector

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