← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 985 · 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 is the odd one out? (a) puts a picture on a page (b) adds space around boxes (c) makes a form box (d) makes headings and lists
  2. 2.🖌️ Which CSS property picks the font style? (a) background-color (b) font-weight (c) text-align (d) font-family
  3. 3.🎯 Which element does the selector #top style? (a) <li id="intro"> (b) <li id="top"> (c) <li class="top"> (d) <div class="big">
  4. 4.✍️ CSS declarations go inside which brackets? (a) ( ) (b) < > (c) [ ] (d) { }
  5. 5.🎯 Which CSS selector matches this element?
    <span class="big" id="main">Hello</span>
    (a) span (b) .main (c) #big (d) .red
  6. 6.🧩 Which language lays out the page? (a) JavaScript (b) CSS (c) HTML
  7. 7.What does justify-content: center 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
  8. 8.🎯 What kind of selector is h1? (a) an id selector (b) a class selector (c) an element selector
  9. 9.⚖️ What colour is the text of this element?
    <p class="menu" id="top">Hi</p>
    CSS:
    #top { color: purple; }
    p { color: blue; }
    (a) purple (b) yellow (c) green (d) blue
  10. 10.🧩 Which language makes a link? (a) HTML (b) CSS (c) JavaScript
  11. 11.✍️ How does a CSS comment start? (a) # (b) // (c) /* (d) <!--
  12. 12.✍️ How many declarations (property: value pairs) are in this rule?
    .note {
      color: red;
      text-align: center;
      font-size: 20px;
      margin: 10px;
    }
  13. 13.🔍 Which is the odd one out? (a) puts a picture on a page (b) makes a link (c) sets colours and fonts (d) makes a form box
  14. 14.✍️ Which sign ends each CSS declaration? (a) ; (b) . (c) : (d) ,
  15. 15.🌈 Hex digits go 0 to 9, then A to which letter? (a) Z (b) F (c) J (d) G
  16. 16.🖌️ Where does the text sit on its line?
    h2 {
      text-align: center;
      background-color: red;
      font-size: 20px;
      color: white;
    }
    (a) in the middle (b) on the left (c) on the right
  17. 17.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 70px;
      padding: 30px;
      border: 3px solid black;
      margin: 20px;
    }
  18. 18.What does color do? (a) colours behind the text (b) makes the text bold (c) sets the letter colour (d) centres a heading
  19. 19.🖌️ What colour are the letters?
    h1 {
      font-size: 28px;
      background-color: blue;
      color: white;
      text-align: center;
    }
    (a) blue (b) green (c) white
  20. 20.✍️ What is the selector in this CSS rule?
    h1 {
      color: red;
      padding: 8px;
      text-align: center;
    }
    (a) p (b) color (c) 8px (d) h1
  21. 21.⚖️ Which selector is the strongest? (a) a class selector (b) an element selector (c) an id selector
  22. 22.🖌️ Which CSS property sets the letter colour? (a) font-family (b) background-color (c) font-size (d) color
  23. 23.📦 In the box model, which part is a solid or dotted edge? (a) border (b) padding (c) content (d) margin
  24. 24.Which of these does HTML do? (a) sets colours and fonts (b) counts down a timer (c) makes a link (d) shows a pop-up message
  25. 25.💪 Which justify-content value packs boxes at the start? (a) flex-end (b) center (c) space-between (d) flex-start
  26. 26.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 60px;
      padding: 25px;
      border: 1px solid black;
      margin: 5px;
    }
  27. 27.🔍 Which is the odd one out? (a) makes a link (b) checks a quiz answer (c) makes headings and lists (d) makes a form box
  28. 28.🎯 Which CSS selector matches this element?
    <h2 class="box" id="end">Hello</h2>
    (a) #box (b) .box (c) #hero (d) .end
  29. 29.🌈 Which colour is rgb(0, 255, 0)? (a) yellow (b) black (c) red (d) bright green
  30. 30.🌈 In #8d0000 the red part is the hex number 8d. What is it as a normal number?
  31. 31.What does font-weight do? (a) picks the font style (b) makes the text bold (c) makes letters bigger (d) centres a heading
  32. 32.True or false: CSS makes headings and lists. (a) False (b) True
  33. 33.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 40px;
      padding: 5px;
      border: 2px solid black;
      margin: 20px;
    }
  34. 34.✍️ In color: blue; which part is the property? (a) blue (b) : (c) ; (d) color
  35. 35.✍️ Which property is set to 2px solid in this rule?
    h2 {
      margin: 10px;
      font-style: italic;
      padding: 8px;
      border: 2px solid;
    }
    (a) 2px solid (b) width (c) font-style (d) border
  36. 36.🔍 Which is the odd one out? (a) makes headings and lists (b) gives the page structure (c) puts a picture on a page (d) changes the text size
  37. 37.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 290px;
      padding: 30px;
      border: 5px solid black;
      margin: 20px;
    }
  38. 38.🧩 Which language changes the text size? (a) JavaScript (b) HTML (c) CSS
  39. 39.🖌️ Which CSS property colours behind the text? (a) background-color (b) color (c) text-align (d) font-weight
  40. 40.🖌️ How big is the text, in px?
    h2 {
      font-size: 12px;
      color: purple;
      text-align: right;
      background-color: black;
    }

Answer key

  1. adds space around boxes
  2. font-family
  3. <li id="top">
  4. { }
  5. span
  6. CSS
  7. puts boxes in the middle
  8. an element selector
  9. purple
  10. HTML
  11. /*
  12. 4
  13. sets colours and fonts
  14. ;
  15. F
  16. in the middle
  17. 176
  18. sets the letter colour
  19. white
  20. h1
  21. an id selector
  22. color
  23. border
  24. makes a link
  25. flex-start
  26. 122
  27. checks a quiz answer
  28. .box
  29. bright green
  30. 141
  31. makes the text bold
  32. False
  33. 94
  34. color
  35. border
  36. changes the text size
  37. 400
  38. CSS
  39. background-color
  40. 12

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