← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 756 · 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.🖌️ Where does the text sit on its line?
    p {
      background-color: purple;
      color: white;
      text-align: left;
      font-size: 16px;
    }
    (a) in the middle (b) on the right (c) on the left
  2. 2.⚖️ What colour is the text of this element?
    <h1 class="red" id="main">Hi</h1>
    CSS:
    .red { color: yellow; }
    #main { color: blue; }
    (a) yellow (b) orange (c) red (d) blue
  3. 3.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 80px;
      padding: 15px;
      border: 3px solid black;
      margin: 0px;
    }
  4. 4.🖌️ What colour are the letters?
    p {
      font-size: 20px;
      text-align: right;
      color: orange;
      background-color: yellow;
    }
    (a) yellow (b) red (c) orange
  5. 5.What does justify-content: center 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
  6. 6.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 6px;
      }
    }
  7. 7.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 470px;
      justify-content: space-between;
    }
    Inside are 4 boxes, each 80px wide (no margins).
  8. 8.📱 What does a media query check? (a) the page title (b) the battery level (c) the time of day (d) the screen width
  9. 9.⚖️ What colour is the text of this element?
    <h2 class="star" id="hero">Hi</h2>
    CSS:
    h2 { color: white; }
    .star { color: black; }
    #hero { color: purple; }
    (a) yellow (b) black (c) purple (d) white
  10. 10.✍️ Which sign goes between a property and its value? (a) ; (b) = (c) - (d) :
  11. 11.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 190px;
      justify-content: space-between;
    }
    Inside are 2 boxes, each 80px wide (no margins).
  12. 12.Which of these does HTML do? (a) rounds box corners (b) changes the text size (c) changes the page live (d) makes a link
  13. 13.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 310px;
      justify-content: flex-end;
    }
    Inside are 3 boxes, each 80px wide (no margins).
  14. 14.🌈 Which colour is rgb(255, 255, 0)? (a) yellow (b) magenta (c) cyan (d) white
  15. 15.⚖️ What colour is the text of this element?
    <h1 class="note" id="top">Hi</h1>
    CSS:
    .note { color: purple; }
    h1 { color: green; }
    (a) red (b) green (c) purple (d) orange
  16. 16.Which of these does JavaScript do? (a) rounds box corners (b) makes headings and lists (c) shows a pop-up message (d) adds space around boxes
  17. 17.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 24px;
      }
    }
  18. 18.📦 In the box model, which part is the gap to other boxes? (a) margin (b) border (c) padding (d) content
  19. 19.🧩 Which language adds space around boxes? (a) JavaScript (b) CSS (c) HTML
  20. 20.📱 Responsive design means a page ___. (a) is only for laptops (b) never changes (c) fits every screen (d) has no pictures
  21. 21.⚖️ Which selector is the weakest? (a) an element selector (b) a class selector (c) an id selector
  22. 22.✍️ How does a CSS comment start? (a) <!-- (b) # (c) // (d) /*
  23. 23.🎨 A CSS file usually ends with which extension? (a) .css (b) .html (c) .js (d) .png
  24. 24.True or false: the border is the line round the box. (a) False (b) True
  25. 25.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 250px;
      padding: 25px;
      border: 5px solid black;
      margin: 20px;
    }
  26. 26.🎯 What kind of selector is #top? (a) a class selector (b) an id selector (c) an element selector
  27. 27.⚖️ What colour is the text of this element?
    <h2 class="note" id="end">Hi</h2>
    CSS:
    #end { color: green; }
    h2 { color: white; }
    .note { color: yellow; }
    (a) green (b) white (c) yellow (d) orange
  28. 28.⚖️ What colour is the text of this element?
    <h1 class="box" id="end">Hi</h1>
    CSS:
    #end { color: blue; }
    .box { color: red; }
    (a) black (b) red (c) purple (d) blue
  29. 29.🖌️ Which CSS property makes letters bigger? (a) font-family (b) font-weight (c) font-size (d) text-align
  30. 30.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 14px;
      }
    }
  31. 31.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 16px;
      }
    }
  32. 32.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 120px;
      justify-content: space-between;
    }
    Inside are 2 boxes, each 40px wide (no margins).
  33. 33.✍️ Which property is set to 10px in this rule?
    body {
      border: 2px solid;
      margin: 10px;
    }
    (a) 10px (b) margin (c) font-weight (d) padding
  34. 34.✍️ How many declarations (property: value pairs) are in this rule?
    #top {
      margin: 10px;
    }
  35. 35.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 360px;
      justify-content: flex-start;
    }
    Inside are 4 boxes, each 80px wide (no margins).
  36. 36.🖌️ What colour are the letters?
    p {
      text-align: right;
      background-color: red;
      font-size: 36px;
      color: purple;
    }
    (a) orange (b) purple (c) red
  37. 37.🌈 Which colour of light is strongest in rgb(175, 11, 116)? (a) red (b) blue (c) green
  38. 38.📱 The screen is 540px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 14px;
      }
    }
    (a) Yes (b) No
  39. 39.🖌️ Which CSS property colours behind the text? (a) font-family (b) background-color (c) font-weight (d) font-size
  40. 40.📱 min-width: 800px applies when the screen is ___. (a) 800px or wider (b) exactly 100px (c) 800px or narrower (d) turned off

Answer key

  1. on the left
  2. blue
  3. 116
  4. orange
  5. puts boxes in the middle
  6. 6
  7. 50
  8. the screen width
  9. purple
  10. :
  11. 30
  12. makes a link
  13. 70
  14. yellow
  15. purple
  16. shows a pop-up message
  17. 24
  18. margin
  19. CSS
  20. fits every screen
  21. an element selector
  22. /*
  23. .css
  24. True
  25. 310
  26. an id selector
  27. green
  28. blue
  29. font-size
  30. 20
  31. 20
  32. 40
  33. margin
  34. 1
  35. 40
  36. purple
  37. red
  38. Yes
  39. background-color
  40. 800px or wider

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