← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 515 · 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.🎨 One CSS file can style how many pages? (a) only one image (b) many pages (c) no pages (d) only one word
  2. 2.⚖️ What colour is the text of this element?
    <h2 class="menu" id="main">Hi</h2>
    CSS:
    .menu { color: yellow; }
    #main { color: black; }
    h2 { color: purple; }
    (a) black (b) purple (c) yellow (d) white
  3. 3.💪 Which flexbox property turns on flexbox? (a) justify-content (b) display: flex (c) gap (d) align-items
  4. 4.🎯 Which CSS selector matches this element?
    <h1 class="note" id="top">Hello</h1>
    (a) .top (b) .big (c) h2 (d) #top
  5. 5.✍️ In color: blue; which part is the property? (a) color (b) blue (c) ; (d) :
  6. 6.✍️ CSS declarations go inside which brackets? (a) [ ] (b) { } (c) ( ) (d) < >
  7. 7.⚖️ What colour is the text of this element?
    <h1 class="big" id="hero">Hi</h1>
    CSS:
    h1 { color: black; }
    h1 { color: purple; }
    (a) purple (b) green (c) black (d) white
  8. 8.🖌️ Which CSS property picks the font style? (a) color (b) font-family (c) background-color (d) text-align
  9. 9.🖌️ Which CSS property colours behind the text? (a) text-align (b) color (c) font-size (d) background-color
  10. 10.🌈 Which hex code is blue? (a) #0000ff (b) #ff0000 (c) #ffff00 (d) #00ffff
  11. 11.🧩 Which language counts down a timer? (a) CSS (b) HTML (c) JavaScript
  12. 12.💪 Which flexbox property picks row or column? (a) justify-content (b) display: flex (c) flex-direction (d) align-items
  13. 13.True or false: padding is space inside the border. (a) False (b) True
  14. 14.Which of these is margin? (a) the gap to other boxes (b) the gap round content (c) a solid or dotted edge (d) the line round the box
  15. 15.🎯 Which element does the selector span style? (a) <span class="red"> (b) <p> (c) <h1 class="red"> (d) <h2 id="top">
  16. 16.🎯 Which element does the selector #top style? (a) <li id="intro"> (b) <div class="note"> (c) <li class="top"> (d) <li id="top">
  17. 17.✍️ What value is given to color in this rule?
    #top {
      font-style: italic;
      padding: 8px;
      color: red;
      margin: 10px;
    }
    (a) center (b) 20px (c) color (d) red
  18. 18.True or false: padding is the line round the box. (a) False (b) True
  19. 19.🎯 What kind of selector is #end? (a) an element selector (b) a class selector (c) an id selector
  20. 20.⚖️ What colour is the text of this element?
    <p class="star" id="main">Hi</p>
    CSS:
    p { color: orange; }
    p { color: red; }
    (a) blue (b) orange (c) red (d) yellow
  21. 21.⚖️ What colour is the text of this element?
    <p class="red" id="top">Hi</p>
    CSS:
    p { color: red; }
    p { color: purple; }
    (a) purple (b) yellow (c) red (d) blue
  22. 22.True or false: p is an id selector. (a) False (b) True
  23. 23.True or false: HTML rounds box corners. (a) True (b) False
  24. 24.✍️ How many declarations (property: value pairs) are in this rule?
    body {
      padding: 8px;
      text-align: center;
    }
  25. 25.What does justify-content: flex-end do? (a) packs boxes at the end (b) packs boxes at the start (c) puts boxes in the middle (d) equal gaps, none at ends
  26. 26.What does font-family do? (a) makes the text bold (b) makes letters bigger (c) picks the font style (d) centres a heading
  27. 27.✍️ What is the selector in this CSS rule?
    h2 {
      margin: 10px;
      text-align: center;
    }
    (a) center (b) margin (c) h2 (d) h1
  28. 28.🧩 Which language adds space around boxes? (a) HTML (b) JavaScript (c) CSS
  29. 29.🎯 Which CSS selector matches this element?
    <h1 class="note" id="intro">Hello</h1>
    (a) .big (b) h1 (c) #main (d) #note
  30. 30.🖌️ What colour are the letters?
    h2 {
      background-color: black;
      font-size: 16px;
      color: red;
      text-align: left;
    }
    (a) black (b) green (c) red
  31. 31.📱 The screen is 820px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 26px;
      }
    }
    (a) No (b) Yes
  32. 32.🎯 Which CSS selector matches this element?
    <h2 class="red" id="intro">Hello</h2>
    (a) .box (b) #main (c) #red (d) .red
  33. 33.🎯 Which CSS selector matches this element?
    <h2 class="red" id="intro">Hello</h2>
    (a) #main (b) #red (c) #intro (d) .intro
  34. 34.True or false: CSS lays out the page. (a) False (b) True
  35. 35.📦 In the box model, which part is space inside the border? (a) content (b) padding (c) border (d) margin
  36. 36.✍️ What value is given to font-size in this rule?
    .note {
      font-weight: bold;
      padding: 8px;
      font-size: 20px;
      margin: 10px;
    }
    (a) center (b) font-size (c) 20px (d) yellow
  37. 37.🔍 Which is the odd one out? (a) changes the page live (b) reacts to a button click (c) makes headings and lists (d) checks a quiz answer
  38. 38.🖌️ What colour is behind the letters?
    p {
      font-size: 36px;
      background-color: black;
      text-align: right;
      color: orange;
    }
    (a) orange (b) black (c) purple
  39. 39.🎨 Which tag connects an outside CSS file? (a) <a> (b) <link> (c) <img> (d) <css>
  40. 40.🌈 Which colour is #00ffff? (a) white (b) red (c) yellow (d) cyan

Answer key

  1. many pages
  2. black
  3. display: flex
  4. #top
  5. color
  6. { }
  7. purple
  8. font-family
  9. background-color
  10. #0000ff
  11. JavaScript
  12. flex-direction
  13. True
  14. the gap to other boxes
  15. <span class="red">
  16. <li id="top">
  17. red
  18. False
  19. an id selector
  20. red
  21. purple
  22. False
  23. False
  24. 2
  25. packs boxes at the end
  26. picks the font style
  27. h2
  28. CSS
  29. h1
  30. red
  31. No
  32. .red
  33. #intro
  34. True
  35. padding
  36. 20px
  37. makes headings and lists
  38. black
  39. <link>
  40. cyan

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