← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 58 · 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.True or false: CSS adds space around boxes. (a) True (b) False
  2. 2.📦 In the box model, which part is the text or picture? (a) content (b) border (c) padding (d) margin
  3. 3.🌈 In #rrggbb, which colour do the last two digits give? (a) blue (b) green (c) red (d) white
  4. 4.✍️ What value is given to width in this rule?
    p {
      font-weight: bold;
      width: 300px;
      border: 2px solid;
    }
    (a) red (b) width (c) 300px (d) italic
  5. 5.💪 Which justify-content value packs boxes at the end? (a) flex-start (b) space-between (c) center (d) flex-end
  6. 6.⚖️ Which selector is the strongest? (a) a class selector (b) an id selector (c) an element selector
  7. 7.🎨 Which tag connects an outside CSS file? (a) <img> (b) <css> (c) <a> (d) <link>
  8. 8.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 120px;
      padding: 30px;
      border: 5px solid black;
      margin: 20px;
    }
  9. 9.📦 In the box model, which part is the gap round content? (a) content (b) margin (c) padding (d) border
  10. 10.💪 Which justify-content value puts boxes in the middle? (a) flex-start (b) center (c) space-between (d) flex-end
  11. 11.🎯 Which CSS selector matches this element?
    <li class="big" id="intro">Hello</li>
    (a) div (b) #main (c) li (d) #big
  12. 12.🎯 Which CSS selector matches this element?
    <h2 class="menu" id="top">Hello</h2>
    (a) .menu (b) .top (c) #menu (d) #intro
  13. 13.✍️ How does a CSS comment start? (a) // (b) <!-- (c) # (d) /*
  14. 14.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 10px;
      }
    }
  15. 15.✍️ What is the selector in this CSS rule?
    body {
      font-size: 20px;
      border: 2px solid;
      width: 300px;
      text-align: center;
    }
    (a) 2px solid (b) .box (c) font-size (d) body
  16. 16.🎨 Which attribute adds CSS inside one tag? (a) href (b) style (c) alt (d) src
  17. 17.⚖️ What colour is the text of this element?
    <h2 class="note" id="intro">Hi</h2>
    CSS:
    h2 { color: blue; }
    h2 { color: orange; }
    (a) black (b) yellow (c) blue (d) orange
  18. 18.🧩 Which language changes the text size? (a) JavaScript (b) CSS (c) HTML
  19. 19.🌈 Which colour of light is strongest in rgb(12, 82, 240)? (a) red (b) green (c) blue
  20. 20.Which of these does CSS do? (a) puts a picture on a page (b) makes headings and lists (c) makes a form box (d) adds space around boxes
  21. 21.What does justify-content: center do? (a) packs boxes at the end (b) equal gaps, none at ends (c) puts boxes in the middle (d) packs boxes at the start
  22. 22.✍️ Which sign goes between a property and its value? (a) = (b) ; (c) - (d) :
  23. 23.📱 The screen is 414px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 30px;
      }
    }
    (a) No (b) Yes
  24. 24.📱 The screen is 414px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 18px;
      }
    }
    (a) No (b) Yes
  25. 25.📦 In the box model, which part is space inside the border? (a) content (b) margin (c) padding (d) border
  26. 26.⚖️ What colour is the text of this element?
    <h1 class="red" id="hero">Hi</h1>
    CSS:
    #hero { color: green; }
    h1 { color: yellow; }
    (a) orange (b) yellow (c) green (d) red
  27. 27.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 140px;
      padding: 30px;
      border: 1px solid black;
      margin: 0px;
    }
  28. 28.🎯 Which CSS selector matches this element?
    <p class="box" id="intro">Hello</p>
    (a) .intro (b) .box (c) #main (d) .star
  29. 29.🖌️ Which CSS property sets the letter colour? (a) font-family (b) text-align (c) font-size (d) color
  30. 30.🖌️ Which CSS property makes the text bold? (a) text-align (b) font-weight (c) font-family (d) background-color
  31. 31.⚖️ What colour is the text of this element?
    <h2 class="note" id="end">Hi</h2>
    CSS:
    #end { color: yellow; }
    #end { color: white; }
    (a) purple (b) white (c) orange (d) yellow
  32. 32.✍️ What value is given to border in this rule?
    .box {
      border: 2px solid;
      font-style: italic;
    }
    (a) 300px (b) border (c) italic (d) 2px solid
  33. 33.🌈 Which hex code is cyan? (a) #00ff00 (b) #000000 (c) #ff00ff (d) #00ffff
  34. 34.📱 The screen is 700px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 22px;
      }
    }
    (a) No (b) Yes
  35. 35.🌈 Which hex code is yellow? (a) #0000ff (b) #ffff00 (c) #ff00ff (d) #00ff00
  36. 36.🧩 Which language makes a link? (a) HTML (b) JavaScript (c) CSS
  37. 37.⚖️ What colour is the text of this element?
    <p class="box" id="end">Hi</p>
    CSS:
    #end { color: white; }
    .box { color: yellow; }
    (a) green (b) white (c) orange (d) yellow
  38. 38.🎯 What kind of selector is #end? (a) an element selector (b) a class selector (c) an id selector
  39. 39.✍️ In color: blue; which part is the property? (a) color (b) blue (c) ; (d) :
  40. 40.✍️ How many declarations (property: value pairs) are in this rule?
    p {
      background-color: yellow;
      text-align: center;
      width: 300px;
    }

Answer key

  1. True
  2. content
  3. blue
  4. 300px
  5. flex-end
  6. an id selector
  7. <link>
  8. 230
  9. padding
  10. center
  11. li
  12. .menu
  13. /*
  14. 16
  15. body
  16. style
  17. orange
  18. CSS
  19. blue
  20. adds space around boxes
  21. puts boxes in the middle
  22. :
  23. No
  24. No
  25. padding
  26. green
  27. 202
  28. .box
  29. color
  30. font-weight
  31. white
  32. 2px solid
  33. #00ffff
  34. Yes
  35. #ffff00
  36. HTML
  37. white
  38. an id selector
  39. color
  40. 3

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