← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 17 · 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="note" id="intro">Hello</span>
    (a) span (b) .intro (c) #main (d) p
  2. 2.✍️ Which sign goes between a property and its value? (a) - (b) = (c) : (d) ;
  3. 3.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 110px;
      padding: 30px;
      border: 3px solid black;
      margin: 10px;
    }
  4. 4.True or false: .big is an element selector. (a) True (b) False
  5. 5.🌈 Hex digits go 0 to 9, then A to which letter? (a) Z (b) G (c) F (d) J
  6. 6.Which of these does JavaScript do? (a) reacts to a button click (b) changes the text size (c) adds space around boxes (d) makes headings and lists
  7. 7.🔍 Which is the odd one out? (a) gives the page structure (b) lays out the page (c) sets colours and fonts (d) adds space around boxes
  8. 8.🖌️ Which CSS property makes letters bigger? (a) text-align (b) font-family (c) font-size (d) font-weight
  9. 9.Which of these does CSS do? (a) puts a picture on a page (b) makes a link (c) gives the page structure (d) rounds box corners
  10. 10.What does background-color do? (a) colours behind the text (b) sets the letter colour (c) picks the font style (d) centres a heading
  11. 11.✍️ How many declarations (property: value pairs) are in this rule?
    li {
      text-align: center;
    }
  12. 12.True or false: JavaScript counts down a timer. (a) False (b) True
  13. 13.📦 In the box model, which part is the gap round content? (a) content (b) margin (c) padding (d) border
  14. 14.True or false: HTML shows a pop-up message. (a) False (b) True
  15. 15.🎯 What kind of selector is #hero? (a) an id selector (b) an element selector (c) a class selector
  16. 16.🎨 Which tag connects an outside CSS file? (a) <link> (b) <img> (c) <css> (d) <a>
  17. 17.✍️ How many declarations (property: value pairs) are in this rule?
    h2 {
      border: 2px solid;
      color: red;
      text-align: center;
      background-color: yellow;
    }
  18. 18.⚖️ What colour is the text of this element?
    <h1 class="box" id="end">Hi</h1>
    CSS:
    #end { color: white; }
    #end { color: black; }
    (a) black (b) white (c) purple (d) blue
  19. 19.🖌️ Where does the text sit on its line?
    h2 {
      font-size: 28px;
      text-align: right;
      color: black;
      background-color: purple;
    }
    (a) on the right (b) on the left (c) in the middle
  20. 20.✍️ What is the selector in this CSS rule?
    h2 {
      font-size: 20px;
      margin: 10px;
    }
    (a) h2 (b) h1 (c) font-size (d) 10px
  21. 21.⚖️ Which selector is the strongest? (a) a class selector (b) an element selector (c) an id selector
  22. 22.🌈 Which hex code is cyan? (a) #ff00ff (b) #0000ff (c) #ffffff (d) #00ffff
  23. 23.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 18px;
      }
    }
  24. 24.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 190px;
      padding: 10px;
      border: 3px solid black;
      margin: 20px;
    }
  25. 25.⚖️ What colour is the text of this element?
    <h1 class="menu" id="end">Hi</h1>
    CSS:
    .menu { color: white; }
    #end { color: orange; }
    h1 { color: black; }
    (a) orange (b) white (c) black (d) red
  26. 26.🧩 Which language checks a quiz answer? (a) CSS (b) HTML (c) JavaScript
  27. 27.What does font-family do? (a) picks the font style (b) makes letters bigger (c) centres a heading (d) makes the text bold
  28. 28.What does justify-content: space-between do? (a) puts boxes in the middle (b) packs boxes at the end (c) equal gaps, none at ends (d) packs boxes at the start
  29. 29.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 130px;
      padding: 25px;
      border: 1px solid black;
      margin: 0px;
    }
  30. 30.🌈 In #00dc00 the green part is the hex number dc. What is it as a normal number?
  31. 31.🧩 Which language lays out the page? (a) HTML (b) JavaScript (c) CSS
  32. 32.🎯 What kind of selector is p? (a) an id selector (b) a class selector (c) an element selector
  33. 33.🎯 Which CSS selector matches this element?
    <span class="big" id="end">Hello</span>
    (a) #big (b) span (c) .red (d) #hero
  34. 34.What does justify-content: flex-end do? (a) equal gaps, none at ends (b) puts boxes in the middle (c) packs boxes at the start (d) packs boxes at the end
  35. 35.⚖️ What colour is the text of this element?
    <h2 class="big" id="main">Hi</h2>
    CSS:
    .big { color: black; }
    #main { color: green; }
    h2 { color: purple; }
    (a) purple (b) green (c) white (d) black
  36. 36.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 130px;
      justify-content: flex-end;
    }
    Inside are 2 boxes, each 60px wide (no margins).
  37. 37.🌈 In #rrggbb, which colour do the last two digits give? (a) green (b) red (c) white (d) blue
  38. 38.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 350px;
      justify-content: flex-start;
    }
    Inside are 4 boxes, each 80px wide (no margins).
  39. 39.True or false: .card is a class selector. (a) True (b) False
  40. 40.True or false: CSS checks a quiz answer. (a) True (b) False

Answer key

  1. span
  2. :
  3. 196
  4. False
  5. F
  6. reacts to a button click
  7. gives the page structure
  8. font-size
  9. rounds box corners
  10. colours behind the text
  11. 1
  12. True
  13. padding
  14. False
  15. an id selector
  16. <link>
  17. 4
  18. black
  19. on the right
  20. h2
  21. an id selector
  22. #00ffff
  23. 12
  24. 256
  25. orange
  26. JavaScript
  27. picks the font style
  28. equal gaps, none at ends
  29. 182
  30. 220
  31. CSS
  32. an element selector
  33. span
  34. packs boxes at the end
  35. green
  36. 10
  37. blue
  38. 30
  39. True
  40. False

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