← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 722 · 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 colour is the text of this element?
    <p class="note" id="main">Hi</p>
    CSS:
    #main { color: blue; }
    #main { color: black; }
    (a) green (b) black (c) blue (d) purple
  2. 2.✍️ In color: blue; which part is the value? (a) color (b) ; (c) blue (d) :
  3. 3.🌈 Which colour is #ff0000? (a) magenta (b) white (c) red (d) blue
  4. 4.🧩 Which language changes the page live? (a) HTML (b) JavaScript (c) CSS
  5. 5.Which of these does HTML do? (a) adds space around boxes (b) rounds box corners (c) makes a form box (d) sets colours and fonts
  6. 6.True or false: .note is a class selector. (a) True (b) False
  7. 7.🎨 One CSS file can style how many pages? (a) only one image (b) only one word (c) many pages (d) no pages
  8. 8.🔍 Which is the odd one out? (a) counts down a timer (b) changes the text size (c) lays out the page (d) rounds box corners
  9. 9.⚖️ What colour is the text of this element?
    <p class="red" id="main">Hi</p>
    CSS:
    #main { color: blue; }
    #main { color: black; }
    (a) black (b) blue (c) green (d) white
  10. 10.🧩 Which language changes the text size? (a) HTML (b) CSS (c) JavaScript
  11. 11.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 160px;
      padding: 25px;
      border: 4px solid black;
      margin: 5px;
    }
  12. 12.📱 min-width: 800px applies when the screen is ___. (a) 800px or narrower (b) 800px or wider (c) exactly 100px (d) turned off
  13. 13.⚖️ What colour is the text of this element?
    <p class="red" id="top">Hi</p>
    CSS:
    p { color: black; }
    p { color: green; }
    (a) green (b) orange (c) blue (d) black
  14. 14.⚖️ What colour is the text of this element?
    <h1 class="note" id="logo">Hi</h1>
    CSS:
    h1 { color: yellow; }
    .note { color: purple; }
    (a) purple (b) white (c) yellow (d) black
  15. 15.🧩 Which language checks a quiz answer? (a) JavaScript (b) HTML (c) CSS
  16. 16.🎯 How many elements on a page should have the same id? (a) 1 (b) any number (c) 5 (d) 2
  17. 17.✍️ In color: blue; which part is the property? (a) blue (b) ; (c) : (d) color
  18. 18.💪 Which justify-content value packs boxes at the start? (a) center (b) flex-end (c) space-between (d) flex-start
  19. 19.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 280px;
      padding: 10px;
      border: 2px solid black;
      margin: 10px;
    }
  20. 20.✍️ Which property is set to yellow in this rule?
    h1 {
      padding: 8px;
      background-color: yellow;
    }
    (a) padding (b) margin (c) background-color (d) yellow
  21. 21.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 140px;
      padding: 30px;
      border: 4px solid black;
      margin: 15px;
    }
  22. 22.🌈 Hex digits go 0 to 9, then A to which letter? (a) Z (b) G (c) F (d) J
  23. 23.💪 Which justify-content value equal gaps, none at ends? (a) flex-end (b) flex-start (c) space-between (d) center
  24. 24.🔍 Which is the odd one out? (a) makes a form box (b) puts a picture on a page (c) makes headings and lists (d) changes the page live
  25. 25.📱 The screen is 540px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 28px;
      }
    }
    (a) Yes (b) No
  26. 26.✍️ What is the selector in this CSS rule?
    #top {
      padding: 8px;
      background-color: yellow;
      font-style: italic;
    }
    (a) padding (b) yellow (c) li (d) #top
  27. 27.True or false: padding is the text or picture. (a) True (b) False
  28. 28.🎯 What kind of selector is .note? (a) a class selector (b) an id selector (c) an element selector
  29. 29.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 22px;
      }
    }
    (a) No (b) Yes
  30. 30.What does justify-content: flex-start do? (a) packs boxes at the end (b) puts boxes in the middle (c) packs boxes at the start (d) equal gaps, none at ends
  31. 31.🎯 Which element does the selector h2 style? (a) <span id="logo"> (b) <h2 class="note"> (c) <div class="note"> (d) <li>
  32. 32.⚖️ Which selector is the weakest? (a) an id selector (b) a class selector (c) an element selector
  33. 33.⚖️ What colour is the text of this element?
    <p class="big" id="logo">Hi</p>
    CSS:
    #logo { color: red; }
    #logo { color: white; }
    (a) yellow (b) purple (c) white (d) red
  34. 34.✍️ How many declarations (property: value pairs) are in this rule?
    p {
      color: red;
      background-color: yellow;
    }
  35. 35.True or false: HTML adds space around boxes. (a) False (b) True
  36. 36.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 50px;
      padding: 10px;
      border: 1px solid black;
      margin: 10px;
    }
  37. 37.✍️ How many declarations (property: value pairs) are in this rule?
    body {
      width: 300px;
    }
  38. 38.📱 The screen is 1366px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 20px;
      }
    }
    (a) No (b) Yes
  39. 39.✍️ CSS declarations go inside which brackets? (a) ( ) (b) { } (c) [ ] (d) < >
  40. 40.✍️ Which property is set to 8px in this rule?
    .note {
      color: red;
      padding: 8px;
      border: 2px solid;
    }
    (a) font-weight (b) 8px (c) border (d) padding

Answer key

  1. black
  2. blue
  3. red
  4. JavaScript
  5. makes a form box
  6. True
  7. many pages
  8. counts down a timer
  9. black
  10. CSS
  11. 228
  12. 800px or wider
  13. green
  14. purple
  15. JavaScript
  16. 1
  17. color
  18. flex-start
  19. 304
  20. background-color
  21. 238
  22. F
  23. space-between
  24. changes the page live
  25. No
  26. #top
  27. False
  28. a class selector
  29. No
  30. packs boxes at the start
  31. <h2 class="note">
  32. an element selector
  33. white
  34. 2
  35. False
  36. 72
  37. 1
  38. Yes
  39. { }
  40. padding

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