← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 459 · 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.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 60px;
      padding: 25px;
      border: 5px solid black;
      margin: 10px;
    }
  2. 2.🖌️ How big is the text, in px?
    h1 {
      background-color: black;
      font-size: 32px;
      text-align: center;
      color: purple;
    }
  3. 3.🌈 In #rrggbb, which colour do the last two digits give? (a) white (b) red (c) blue (d) green
  4. 4.🔍 Which is the odd one out? (a) sets colours and fonts (b) checks a quiz answer (c) adds space around boxes (d) rounds box corners
  5. 5.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 400px;
      justify-content: space-between;
    }
    Inside are 4 boxes, each 40px wide (no margins).
  6. 6.📱 max-width: 600px applies when the screen is ___. (a) exactly 1000px (b) 600px or narrower (c) 600px or wider (d) turned off
  7. 7.🎯 Which CSS selector matches this element?
    <li class="red" id="end">Hello</li>
    (a) div (b) #red (c) #hero (d) li
  8. 8.🔍 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
  9. 9.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 12px;
      }
    }
  10. 10.✍️ In color: blue; which part is the property? (a) : (b) blue (c) ; (d) color
  11. 11.⚖️ What colour is the text of this element?
    <p class="red" id="intro">Hi</p>
    CSS:
    p { color: green; }
    .red { color: blue; }
    #intro { color: yellow; }
    (a) green (b) blue (c) yellow (d) black
  12. 12.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 290px;
      padding: 10px;
      border: 1px solid black;
      margin: 0px;
    }
  13. 13.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 3 (b) 2 (c) 6 (d) 4
  14. 14.What does text-align do? (a) sets the letter colour (b) makes letters bigger (c) centres a heading (d) colours behind the text
  15. 15.What does justify-content: center do? (a) packs boxes at the end (b) equal gaps, none at ends (c) packs boxes at the start (d) puts boxes in the middle
  16. 16.💪 Which justify-content value puts boxes in the middle? (a) space-between (b) flex-start (c) center (d) flex-end
  17. 17.✍️ Which property is set to bold in this rule?
    .note {
      border: 2px solid;
      font-weight: bold;
      width: 300px;
      padding: 8px;
    }
    (a) font-weight (b) width (c) border (d) bold
  18. 18.✍️ Which property is set to red in this rule?
    h1 {
      margin: 10px;
      border: 2px solid;
      color: red;
      font-style: italic;
    }
    (a) font-size (b) color (c) text-align (d) red
  19. 19.🖌️ What colour is behind the letters?
    p {
      font-size: 36px;
      color: white;
      text-align: right;
      background-color: yellow;
    }
    (a) yellow (b) purple (c) white
  20. 20.✍️ Which sign goes between a property and its value? (a) = (b) ; (c) - (d) :
  21. 21.🧩 Which language makes a link? (a) JavaScript (b) HTML (c) CSS
  22. 22.🧩 Which language lays out the page? (a) JavaScript (b) CSS (c) HTML
  23. 23.🌈 In #780000 the red part is the hex number 78. What is it as a normal number?
  24. 24.True or false: #main is a class selector. (a) True (b) False
  25. 25.What does background-color do? (a) makes letters bigger (b) sets the letter colour (c) colours behind the text (d) makes the text bold
  26. 26.🖌️ What colour is behind the letters?
    li {
      font-size: 40px;
      background-color: blue;
      color: red;
      text-align: left;
    }
    (a) blue (b) black (c) red
  27. 27.True or false: padding is space outside the border. (a) True (b) False
  28. 28.📱 Which tag helps phones show a page at the right size? (a) the hr tag (b) the br tag (c) the title tag (d) the viewport meta tag
  29. 29.What does justify-content: flex-start 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
  30. 30.🌈 Which colour is #00ffff? (a) blue (b) red (c) black (d) cyan
  31. 31.🎯 How many elements on a page should have the same id? (a) 1 (b) 2 (c) 5 (d) any number
  32. 32.🎯 Which sign starts a class selector? (a) # (b) @ (c) & (d) .
  33. 33.True or false: HTML makes a form box. (a) True (b) False
  34. 34.True or false: JavaScript makes a link. (a) True (b) False
  35. 35.💪 Which justify-content value packs boxes at the start? (a) flex-end (b) flex-start (c) space-between (d) center
  36. 36.🌈 In #rrggbb, which colour do the first two digits give? (a) red (b) green (c) black (d) blue
  37. 37.💪 Which flexbox property spaces boxes along a row? (a) justify-content (b) align-items (c) gap (d) flex-direction
  38. 38.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 8px;
      }
    }
    (a) No (b) Yes
  39. 39.⚖️ What colour is the text of this element?
    <h1 class="note" id="intro">Hi</h1>
    CSS:
    #intro { color: blue; }
    h1 { color: yellow; }
    .note { color: green; }
    (a) blue (b) yellow (c) orange (d) green
  40. 40.✍️ How many declarations (property: value pairs) are in this rule?
    p {
      margin: 10px;
      border: 2px solid;
      text-align: center;
    }

Answer key

  1. 140
  2. 32
  3. blue
  4. checks a quiz answer
  5. 80
  6. 600px or narrower
  7. li
  8. gives the page structure
  9. 16
  10. color
  11. yellow
  12. 312
  13. 3
  14. centres a heading
  15. puts boxes in the middle
  16. center
  17. font-weight
  18. color
  19. yellow
  20. :
  21. HTML
  22. CSS
  23. 120
  24. False
  25. colours behind the text
  26. blue
  27. False
  28. the viewport meta tag
  29. packs boxes at the start
  30. cyan
  31. 1
  32. .
  33. True
  34. False
  35. flex-start
  36. red
  37. justify-content
  38. Yes
  39. blue
  40. 3

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