← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 458 · 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 of these is padding? (a) space inside the border (b) the line round the box (c) a solid or dotted edge (d) space outside the border
  2. 2.What does justify-content: space-between do? (a) puts boxes in the middle (b) packs boxes at the start (c) packs boxes at the end (d) equal gaps, none at ends
  3. 3.🖌️ Which CSS property centres a heading? (a) color (b) font-size (c) text-align (d) font-weight
  4. 4.🔍 Which is the odd one out? (a) gives the page structure (b) makes a form box (c) shows a pop-up message (d) puts a picture on a page
  5. 5.📱 The screen is 540px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 32px;
      }
    }
    (a) No (b) Yes
  6. 6.Which of these does JavaScript do? (a) sets colours and fonts (b) changes the page live (c) puts a picture on a page (d) adds space around boxes
  7. 7.✍️ How many declarations (property: value pairs) are in this rule?
    li {
      color: red;
      font-size: 20px;
      margin: 10px;
    }
  8. 8.✍️ Which property is set to italic in this rule?
    body {
      font-size: 20px;
      color: red;
      font-style: italic;
    }
    (a) italic (b) color (c) font-size (d) font-style
  9. 9.✍️ In color: blue; which part is the property? (a) ; (b) : (c) color (d) blue
  10. 10.🌈 Hex digits go 0 to 9, then A to which letter? (a) J (b) F (c) Z (d) G
  11. 11.✍️ Which property is set to italic in this rule?
    .note {
      font-style: italic;
      padding: 8px;
    }
    (a) font-size (b) color (c) italic (d) font-style
  12. 12.✍️ Which property is set to 10px in this rule?
    .box {
      font-weight: bold;
      margin: 10px;
      text-align: center;
      padding: 8px;
    }
    (a) font-weight (b) margin (c) padding (d) 10px
  13. 13.True or false: .big is an id selector. (a) False (b) True
  14. 14.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 360px;
      justify-content: center;
    }
    Inside are 2 boxes, each 100px wide (no margins).
  15. 15.⚖️ What colour is the text of this element?
    <h1 class="menu" id="end">Hi</h1>
    CSS:
    #end { color: green; }
    #end { color: blue; }
    (a) orange (b) green (c) red (d) blue
  16. 16.📱 The screen is 414px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 14px;
      }
    }
    (a) No (b) Yes
  17. 17.🌈 Which hex code is cyan? (a) #00ffff (b) #000000 (c) #ff00ff (d) #0000ff
  18. 18.🌈 Which colour of light is strongest in rgb(204, 89, 90)? (a) blue (b) red (c) green
  19. 19.🖌️ What colour are the letters?
    p {
      color: red;
      background-color: blue;
      font-size: 32px;
      text-align: center;
    }
    (a) blue (b) yellow (c) red
  20. 20.✍️ What value is given to background-color in this rule?
    h1 {
      font-weight: bold;
      margin: 10px;
      padding: 8px;
      background-color: yellow;
    }
    (a) 10px (b) background-color (c) 8px (d) yellow
  21. 21.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 100px;
      padding: 25px;
      border: 2px solid black;
      margin: 20px;
    }
  22. 22.🖌️ How big is the text, in px?
    h2 {
      font-size: 20px;
      text-align: left;
      color: orange;
      background-color: purple;
    }
  23. 23.💪 Which justify-content value packs boxes at the end? (a) center (b) flex-start (c) flex-end (d) space-between
  24. 24.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 370px;
      justify-content: flex-end;
    }
    Inside are 4 boxes, each 80px wide (no margins).
  25. 25.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 110px;
      padding: 5px;
      border: 4px solid black;
      margin: 5px;
    }
  26. 26.🎨 A CSS file usually ends with which extension? (a) .js (b) .html (c) .png (d) .css
  27. 27.⚖️ Which selector is the weakest? (a) an id selector (b) a class selector (c) an element selector
  28. 28.🧩 Which language changes the text size? (a) JavaScript (b) CSS (c) HTML
  29. 29.📱 The screen is 700px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 14px;
      }
    }
    (a) No (b) Yes
  30. 30.✍️ Which property is set to 2px solid in this rule?
    .note {
      border: 2px solid;
      background-color: yellow;
    }
    (a) border (b) 2px solid (c) width (d) font-style
  31. 31.🔍 Which is the odd one out? (a) checks a quiz answer (b) makes headings and lists (c) gives the page structure (d) makes a form box
  32. 32.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 22px;
      }
    }
  33. 33.🌈 Which colour is rgb(255, 0, 0)? (a) white (b) magenta (c) cyan (d) red
  34. 34.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 260px;
      padding: 15px;
      border: 2px solid black;
      margin: 10px;
    }
  35. 35.⚖️ Which selector is the strongest? (a) an id selector (b) a class selector (c) an element selector
  36. 36.🎯 Which CSS selector matches this element?
    <p class="red" id="top">Hello</p>
    (a) #intro (b) #red (c) #top (d) .box
  37. 37.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 28px;
      }
    }
  38. 38.📦 In the box model, which part is the text or picture? (a) border (b) margin (c) padding (d) content
  39. 39.🌈 Which colour is #000000? (a) bright green (b) black (c) white (d) cyan
  40. 40.✍️ How many declarations (property: value pairs) are in this rule?
    .box {
      font-size: 20px;
    }

Answer key

  1. space inside the border
  2. equal gaps, none at ends
  3. text-align
  4. shows a pop-up message
  5. No
  6. changes the page live
  7. 3
  8. font-style
  9. color
  10. F
  11. font-style
  12. margin
  13. False
  14. 80
  15. blue
  16. No
  17. #00ffff
  18. red
  19. red
  20. yellow
  21. 194
  22. 20
  23. flex-end
  24. 50
  25. 138
  26. .css
  27. an element selector
  28. CSS
  29. Yes
  30. border
  31. checks a quiz answer
  32. 22
  33. red
  34. 294
  35. an id selector
  36. #top
  37. 20
  38. content
  39. black
  40. 1

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