← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 154 · 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 margin? (a) space inside the border (b) the text or picture (c) a solid or dotted edge (d) space outside the border
  2. 2.🌈 Which colour is #ffff00? (a) yellow (b) magenta (c) blue (d) bright green
  3. 3.What does color do? (a) sets the letter colour (b) colours behind the text (c) makes the text bold (d) centres a heading
  4. 4.✍️ Which property is set to 8px in this rule?
    body {
      font-style: italic;
      margin: 10px;
      padding: 8px;
    }
    (a) 8px (b) font-weight (c) padding (d) border
  5. 5.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 270px;
      padding: 10px;
      border: 5px solid black;
      margin: 10px;
    }
  6. 6.✍️ In color: blue; which part is the property? (a) : (b) blue (c) color (d) ;
  7. 7.📱 max-width: 600px applies when the screen is ___. (a) turned off (b) exactly 1000px (c) 600px or narrower (d) 600px or wider
  8. 8.🎯 Which CSS selector matches this element?
    <h2 class="star" id="logo">Hello</h2>
    (a) .menu (b) #end (c) .logo (d) #logo
  9. 9.✍️ What is the selector in this CSS rule?
    li {
      text-align: center;
      padding: 8px;
      background-color: yellow;
      width: 300px;
    }
    (a) li (b) 8px (c) body (d) text-align
  10. 10.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 300px;
      padding: 25px;
      border: 4px solid black;
      margin: 0px;
    }
  11. 11.🖌️ Which CSS property colours behind the text? (a) font-size (b) font-weight (c) text-align (d) background-color
  12. 12.✍️ How many declarations (property: value pairs) are in this rule?
    p {
      background-color: yellow;
      border: 2px solid;
      text-align: center;
      font-size: 20px;
    }
  13. 13.📦 In the box model, which part is the gap round content? (a) margin (b) border (c) content (d) padding
  14. 14.🖌️ Which CSS property picks the font style? (a) font-family (b) background-color (c) font-size (d) font-weight
  15. 15.📦 In the box model, which part is space outside the border? (a) margin (b) content (c) border (d) padding
  16. 16.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 90px;
      padding: 30px;
      border: 2px solid black;
      margin: 20px;
    }
  17. 17.🌈 In #0000ee the blue part is the hex number ee. What is it as a normal number?
  18. 18.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 200px;
      justify-content: flex-end;
    }
    Inside are 4 boxes, each 40px wide (no margins).
  19. 19.💪 Which flexbox property sets space between boxes? (a) justify-content (b) display: flex (c) gap (d) flex-direction
  20. 20.⚖️ What colour is the text of this element?
    <p class="menu" id="end">Hi</p>
    CSS:
    .menu { color: black; }
    #end { color: blue; }
    p { color: purple; }
    (a) blue (b) black (c) red (d) purple
  21. 21.📱 The screen is 820px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 22px;
      }
    }
    (a) No (b) Yes
  22. 22.🎯 How many elements on a page should have the same id? (a) 1 (b) 5 (c) 2 (d) any number
  23. 23.📱 The screen is 414px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 10px;
      }
    }
    (a) Yes (b) No
  24. 24.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 8px;
      }
    }
  25. 25.🖌️ What colour is behind the letters?
    h2 {
      font-size: 20px;
      background-color: green;
      text-align: right;
      color: white;
    }
    (a) green (b) orange (c) white
  26. 26.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 160px;
      padding: 20px;
      border: 5px solid black;
      margin: 10px;
    }
  27. 27.True or false: padding is space outside the border. (a) True (b) False
  28. 28.🖌️ Which CSS property makes letters bigger? (a) background-color (b) text-align (c) font-family (d) font-size
  29. 29.🔍 Which is the odd one out? (a) rounds box corners (b) counts down a timer (c) lays out the page (d) sets colours and fonts
  30. 30.📱 The screen is 1366px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 16px;
      }
    }
    (a) Yes (b) No
  31. 31.🌈 Which colour is #000000? (a) blue (b) bright green (c) red (d) black
  32. 32.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 160px;
      justify-content: space-between;
    }
    Inside are 2 boxes, each 40px wide (no margins).
  33. 33.🧩 Which language puts a picture on a page? (a) CSS (b) JavaScript (c) HTML
  34. 34.True or false: the border is the text or picture. (a) False (b) True
  35. 35.⚖️ Which selector is the weakest? (a) a class selector (b) an element selector (c) an id selector
  36. 36.🎨 What does CSS stand for? (a) Computer Style Sheets (b) Creative Sheet System (c) Cascading Style Sheets (d) Colourful Site Styles
  37. 37.🎯 Which element does the selector .box style? (a) <h1 class="menu"> (b) <p class="star"> (c) <p id="box"> (d) <p class="box">
  38. 38.🧩 Which language makes headings and lists? (a) HTML (b) JavaScript (c) CSS
  39. 39.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 330px;
      justify-content: flex-start;
    }
    Inside are 4 boxes, each 80px wide (no margins).
  40. 40.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 180px;
      padding: 30px;
      border: 1px solid black;
      margin: 15px;
    }

Answer key

  1. space outside the border
  2. yellow
  3. sets the letter colour
  4. padding
  5. 300
  6. color
  7. 600px or narrower
  8. #logo
  9. li
  10. 358
  11. background-color
  12. 4
  13. padding
  14. font-family
  15. margin
  16. 194
  17. 238
  18. 40
  19. gap
  20. blue
  21. No
  22. 1
  23. Yes
  24. 8
  25. green
  26. 210
  27. False
  28. font-size
  29. counts down a timer
  30. No
  31. black
  32. 80
  33. HTML
  34. False
  35. an element selector
  36. Cascading Style Sheets
  37. <p class="box">
  38. HTML
  39. 10
  40. 272

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