← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 384 · 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.📱 min-width: 800px applies when the screen is ___. (a) turned off (b) 800px or wider (c) 800px or narrower (d) exactly 100px
  2. 2.What does justify-content: flex-start do? (a) equal gaps, none at ends (b) puts boxes in the middle (c) packs boxes at the end (d) packs boxes at the start
  3. 3.True or false: img is an element selector. (a) False (b) True
  4. 4.📱 The screen is 414px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 24px;
      }
    }
    (a) Yes (b) No
  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: 200px;
      padding: 5px;
      border: 5px solid black;
      margin: 0px;
    }
  6. 6.📱 Which tag helps phones show a page at the right size? (a) the title tag (b) the viewport meta tag (c) the hr tag (d) the br tag
  7. 7.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 190px;
      justify-content: flex-start;
    }
    Inside are 4 boxes, each 40px wide (no margins).
  8. 8.🖌️ Where does the text sit on its line?
    li {
      text-align: right;
      background-color: green;
      color: white;
      font-size: 12px;
    }
    (a) on the right (b) on the left (c) in the middle
  9. 9.✍️ What is the selector in this CSS rule?
    h2 {
      border: 2px solid;
      background-color: yellow;
    }
    (a) yellow (b) h2 (c) h1 (d) border
  10. 10.🎯 Which element does the selector h2 style? (a) <li> (b) <div class="note"> (c) <h2 class="note"> (d) <span id="logo">
  11. 11.📦 In the box model, which part is the gap round content? (a) padding (b) border (c) content (d) margin
  12. 12.📱 Responsive design means a page ___. (a) fits every screen (b) never changes (c) has no pictures (d) is only for laptops
  13. 13.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 170px;
      padding: 20px;
      border: 1px solid black;
      margin: 20px;
    }
  14. 14.✍️ In color: blue; which part is the property? (a) ; (b) : (c) blue (d) color
  15. 15.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 230px;
      padding: 30px;
      border: 2px solid black;
      margin: 0px;
    }
  16. 16.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 6px;
      }
    }
    (a) Yes (b) No
  17. 17.⚖️ What colour is the text of this element?
    <h2 class="red" id="top">Hi</h2>
    CSS:
    .red { color: blue; }
    .red { color: white; }
    (a) black (b) blue (c) white (d) red
  18. 18.True or false: li is an id selector. (a) True (b) False
  19. 19.🎨 One CSS file can style how many pages? (a) only one word (b) only one image (c) no pages (d) many pages
  20. 20.🖌️ How big is the text, in px?
    h2 {
      text-align: left;
      background-color: purple;
      font-size: 28px;
      color: white;
    }
  21. 21.⚖️ What colour is the text of this element?
    <h1 class="star" id="intro">Hi</h1>
    CSS:
    .star { color: red; }
    .star { color: orange; }
    (a) white (b) orange (c) blue (d) red
  22. 22.✍️ What is the selector in this CSS rule?
    h1 {
      padding: 8px;
      font-weight: bold;
      width: 300px;
    }
    (a) padding (b) h1 (c) bold (d) p
  23. 23.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 160px;
      padding: 10px;
      border: 3px solid black;
      margin: 20px;
    }
  24. 24.🔍 Which is the odd one out? (a) rounds box corners (b) lays out the page (c) counts down a timer (d) adds space around boxes
  25. 25.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 14px;
      }
    }
    (a) Yes (b) No
  26. 26.🌈 What is the biggest number one colour can have in rgb()? (a) 99 (b) 255 (c) 1000 (d) 100
  27. 27.⚖️ What colour is the text of this element?
    <h1 class="star" id="intro">Hi</h1>
    CSS:
    .star { color: yellow; }
    h1 { color: white; }
    (a) green (b) red (c) white (d) yellow
  28. 28.✍️ In color: blue; which part is the value? (a) : (b) color (c) blue (d) ;
  29. 29.🌈 In #003b00 the green part is the hex number 3b. What is it as a normal number?
  30. 30.💪 Which justify-content value packs boxes at the end? (a) space-between (b) flex-end (c) flex-start (d) center
  31. 31.True or false: #top is an id selector. (a) False (b) True
  32. 32.✍️ CSS declarations go inside which brackets? (a) ( ) (b) [ ] (c) < > (d) { }
  33. 33.🖌️ Which CSS property colours behind the text? (a) font-weight (b) color (c) text-align (d) background-color
  34. 34.Which of these does HTML do? (a) adds space around boxes (b) changes the text size (c) makes a link (d) checks a quiz answer
  35. 35.✍️ How many declarations (property: value pairs) are in this rule?
    li {
      border: 2px solid;
    }
  36. 36.✍️ What is the selector in this CSS rule?
    p {
      margin: 10px;
      padding: 8px;
      color: red;
      border: 2px solid;
    }
    (a) margin (b) p (c) .note (d) 8px
  37. 37.What does font-size do? (a) picks the font style (b) makes letters bigger (c) colours behind the text (d) makes the text bold
  38. 38.🌈 Which colour of light is strongest in rgb(210, 49, 127)? (a) blue (b) red (c) green
  39. 39.⚖️ Which selector is the strongest? (a) an element selector (b) an id selector (c) a class selector
  40. 40.💪 Which justify-content value puts boxes in the middle? (a) space-between (b) flex-start (c) flex-end (d) center

Answer key

  1. 800px or wider
  2. packs boxes at the start
  3. True
  4. No
  5. 220
  6. the viewport meta tag
  7. 30
  8. on the right
  9. h2
  10. <h2 class="note">
  11. padding
  12. fits every screen
  13. 252
  14. color
  15. 294
  16. Yes
  17. white
  18. False
  19. many pages
  20. 28
  21. orange
  22. h1
  23. 226
  24. counts down a timer
  25. No
  26. 255
  27. yellow
  28. blue
  29. 59
  30. flex-end
  31. True
  32. { }
  33. background-color
  34. makes a link
  35. 1
  36. p
  37. makes letters bigger
  38. red
  39. an id selector
  40. center

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