← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 832 · 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 padding in this rule?
    h2 {
      padding: 8px;
      font-weight: bold;
    }
    (a) bold (b) 2px solid (c) padding (d) 8px
  2. 2.True or false: padding is a solid or dotted edge. (a) False (b) True
  3. 3.True or false: padding is space inside the border. (a) True (b) False
  4. 4.🎨 Which tag connects an outside CSS file? (a) <css> (b) <img> (c) <link> (d) <a>
  5. 5.Which of these is padding? (a) the line round the box (b) the text or picture (c) a solid or dotted edge (d) the gap round content
  6. 6.🌈 Which colour of light is strongest in rgb(192, 117, 133)? (a) green (b) red (c) blue
  7. 7.📱 The screen is 1100px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 10px;
      }
    }
    (a) Yes (b) No
  8. 8.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 130px;
      padding: 5px;
      border: 4px solid black;
      margin: 5px;
    }
  9. 9.🧩 Which language rounds box corners? (a) JavaScript (b) HTML (c) CSS
  10. 10.🎯 What kind of selector is #hero? (a) a class selector (b) an id selector (c) an element selector
  11. 11.📦 In the box model, which part is a solid or dotted edge? (a) content (b) border (c) padding (d) margin
  12. 12.True or false: JavaScript counts down a timer. (a) False (b) True
  13. 13.🔍 Which is the odd one out? (a) puts a picture on a page (b) gives the page structure (c) shows a pop-up message (d) makes a link
  14. 14.⚖️ What colour is the text of this element?
    <h2 class="red" id="hero">Hi</h2>
    CSS:
    .red { color: purple; }
    .red { color: black; }
    (a) white (b) red (c) black (d) purple
  15. 15.🧩 Which language lays out the page? (a) HTML (b) CSS (c) JavaScript
  16. 16.✍️ What value is given to width in this rule?
    li {
      width: 300px;
      padding: 8px;
      color: red;
    }
    (a) width (b) red (c) italic (d) 300px
  17. 17.⚖️ What colour is the text of this element?
    <p class="red" id="end">Hi</p>
    CSS:
    #end { color: black; }
    .red { color: red; }
    p { color: purple; }
    (a) orange (b) black (c) red (d) purple
  18. 18.✍️ How does a CSS comment start? (a) /* (b) // (c) <!-- (d) #
  19. 19.🎯 What kind of selector is li? (a) an id selector (b) an element selector (c) a class selector
  20. 20.🧩 Which language changes the text size? (a) CSS (b) HTML (c) JavaScript
  21. 21.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 320px;
      justify-content: flex-start;
    }
    Inside are 3 boxes, each 100px wide (no margins).
  22. 22.What does justify-content: center do? (a) equal gaps, none at ends (b) packs boxes at the start (c) puts boxes in the middle (d) packs boxes at the end
  23. 23.🎯 Can many elements share the same class? (a) Yes (b) No
  24. 24.True or false: CSS rounds box corners. (a) False (b) True
  25. 25.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 210px;
      padding: 30px;
      border: 5px solid black;
      margin: 5px;
    }
  26. 26.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 150px;
      justify-content: flex-end;
    }
    Inside are 2 boxes, each 40px wide (no margins).
  27. 27.🎯 Which CSS selector matches this element?
    <h1 class="big" id="logo">Hello</h1>
    (a) h1 (b) .logo (c) #big (d) .red
  28. 28.What does font-size do? (a) colours behind the text (b) picks the font style (c) sets the letter colour (d) makes letters bigger
  29. 29.✍️ How many declarations (property: value pairs) are in this rule?
    .note {
      padding: 8px;
    }
  30. 30.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 210px;
      justify-content: flex-start;
    }
    Inside are 3 boxes, each 60px wide (no margins).
  31. 31.💪 Which justify-content value equal gaps, none at ends? (a) flex-end (b) center (c) flex-start (d) space-between
  32. 32.📱 max-width: 600px applies when the screen is ___. (a) turned off (b) exactly 1000px (c) 600px or wider (d) 600px or narrower
  33. 33.🔍 Which is the odd one out? (a) puts a picture on a page (b) makes a form box (c) adds space around boxes (d) makes headings and lists
  34. 34.🖌️ How big is the text, in px?
    li {
      font-size: 20px;
      background-color: white;
      color: purple;
      text-align: right;
    }
  35. 35.✍️ How many declarations (property: value pairs) are in this rule?
    .box {
      padding: 8px;
    }
  36. 36.💪 Which flexbox property picks row or column? (a) align-items (b) display: flex (c) gap (d) flex-direction
  37. 37.✍️ In color: blue; which part is the property? (a) : (b) color (c) blue (d) ;
  38. 38.Which of these does JavaScript do? (a) shows a pop-up message (b) puts a picture on a page (c) rounds box corners (d) changes the text size
  39. 39.⚖️ What colour is the text of this element?
    <h1 class="box" id="intro">Hi</h1>
    CSS:
    h1 { color: red; }
    h1 { color: black; }
    (a) red (b) black (c) green (d) orange
  40. 40.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the shorter one (b) the later one (c) the first one (d) neither

Answer key

  1. 8px
  2. False
  3. True
  4. <link>
  5. the gap round content
  6. red
  7. No
  8. 158
  9. CSS
  10. an id selector
  11. border
  12. True
  13. shows a pop-up message
  14. black
  15. CSS
  16. 300px
  17. black
  18. /*
  19. an element selector
  20. CSS
  21. 20
  22. puts boxes in the middle
  23. Yes
  24. True
  25. 290
  26. 70
  27. h1
  28. makes letters bigger
  29. 1
  30. 30
  31. space-between
  32. 600px or narrower
  33. adds space around boxes
  34. 20
  35. 1
  36. flex-direction
  37. color
  38. shows a pop-up message
  39. black
  40. the later one

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