← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 671 · 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.🎨 A CSS file usually ends with which extension? (a) .css (b) .png (c) .html (d) .js
  2. 2.🔍 Which is the odd one out? (a) puts a picture on a page (b) makes headings and lists (c) shows a pop-up message (d) makes a form box
  3. 3.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 150px;
      justify-content: space-between;
    }
    Inside are 2 boxes, each 60px wide (no margins).
  4. 4.⚖️ What colour is the text of this element?
    <h2 class="red" id="logo">Hi</h2>
    CSS:
    h2 { color: green; }
    h2 { color: orange; }
    (a) purple (b) blue (c) orange (d) green
  5. 5.✍️ Which sign goes between a property and its value? (a) = (b) - (c) : (d) ;
  6. 6.🖌️ What colour are the letters?
    p {
      color: red;
      font-size: 32px;
      background-color: black;
      text-align: right;
    }
    (a) red (b) yellow (c) black
  7. 7.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 120px;
      padding: 20px;
      border: 2px solid black;
      margin: 15px;
    }
  8. 8.🌈 In #00ec00 the green part is the hex number ec. What is it as a normal number?
  9. 9.True or false: CSS makes a link. (a) False (b) True
  10. 10.📱 The screen is 1100px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 24px;
      }
    }
    (a) Yes (b) No
  11. 11.✍️ In color: blue; which part is the value? (a) : (b) blue (c) ; (d) color
  12. 12.🌈 Which colour is #ffff00? (a) yellow (b) blue (c) red (d) cyan
  13. 13.⚖️ Which selector is the weakest? (a) an element selector (b) a class selector (c) an id selector
  14. 14.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 170px;
      justify-content: flex-end;
    }
    Inside are 3 boxes, each 40px wide (no margins).
  15. 15.True or false: body is an element selector. (a) False (b) True
  16. 16.✍️ What is the selector in this CSS rule?
    .note {
      text-align: center;
      font-weight: bold;
      font-size: 20px;
      margin: 10px;
    }
    (a) bold (b) text-align (c) #top (d) .note
  17. 17.🎯 Which CSS selector matches this element?
    <div class="box" id="hero">Hello</div>
    (a) .hero (b) .star (c) span (d) div
  18. 18.📦 In the box model, which part is the text or picture? (a) padding (b) border (c) content (d) margin
  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: 160px;
      padding: 5px;
      border: 4px solid black;
      margin: 10px;
    }
  20. 20.What does font-family do? (a) makes letters bigger (b) picks the font style (c) colours behind the text (d) makes the text bold
  21. 21.📱 The screen is 414px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 14px;
      }
    }
    (a) No (b) Yes
  22. 22.What does font-size do? (a) centres a heading (b) makes letters bigger (c) picks the font style (d) makes the text bold
  23. 23.🖌️ What colour is behind the letters?
    p {
      background-color: red;
      text-align: center;
      color: purple;
      font-size: 28px;
    }
    (a) purple (b) red (c) blue
  24. 24.🌈 In #3a0000 the red part is the hex number 3a. What is it as a normal number?
  25. 25.What does color do? (a) centres a heading (b) makes the text bold (c) sets the letter colour (d) makes letters bigger
  26. 26.📱 What does a media query check? (a) the battery level (b) the time of day (c) the page title (d) the screen width
  27. 27.What does font-weight do? (a) makes the text bold (b) centres a heading (c) makes letters bigger (d) sets the letter colour
  28. 28.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 22px;
      }
    }
  29. 29.🎯 Which element does the selector #main style? (a) <h1 id="logo"> (b) <h1 id="main"> (c) <h2 class="red"> (d) <h1 class="main">
  30. 30.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 180px;
      justify-content: center;
    }
    Inside are 2 boxes, each 50px wide (no margins).
  31. 31.What does justify-content: space-between do? (a) equal gaps, none at ends (b) puts boxes in the middle (c) packs boxes at the start (d) packs boxes at the end
  32. 32.✍️ What value is given to color in this rule?
    h1 {
      font-weight: bold;
      color: red;
    }
    (a) center (b) 20px (c) red (d) color
  33. 33.Which of these does JavaScript do? (a) gives the page structure (b) makes headings and lists (c) reacts to a button click (d) lays out the page
  34. 34.🎯 What kind of selector is .star? (a) an element selector (b) a class selector (c) an id selector
  35. 35.True or false: p is a class selector. (a) True (b) False
  36. 36.📱 Which tag helps phones show a page at the right size? (a) the br tag (b) the title tag (c) the viewport meta tag (d) the hr tag
  37. 37.✍️ Which sign ends each CSS declaration? (a) ; (b) : (c) . (d) ,
  38. 38.What does justify-content: flex-start do? (a) packs boxes at the start (b) puts boxes in the middle (c) equal gaps, none at ends (d) packs boxes at the end
  39. 39.⚖️ What colour is the text of this element?
    <p class="box" id="hero">Hi</p>
    CSS:
    p { color: green; }
    #hero { color: blue; }
    .box { color: purple; }
    (a) orange (b) purple (c) blue (d) green
  40. 40.✍️ What is the selector in this CSS rule?
    p {
      font-weight: bold;
      width: 300px;
      border: 2px solid;
      background-color: yellow;
    }
    (a) p (b) font-weight (c) 300px (d) .note

Answer key

  1. .css
  2. shows a pop-up message
  3. 30
  4. orange
  5. :
  6. red
  7. 194
  8. 236
  9. False
  10. Yes
  11. blue
  12. yellow
  13. an element selector
  14. 50
  15. True
  16. .note
  17. div
  18. content
  19. 178
  20. picks the font style
  21. Yes
  22. makes letters bigger
  23. red
  24. 58
  25. sets the letter colour
  26. the screen width
  27. makes the text bold
  28. 20
  29. <h1 id="main">
  30. 40
  31. equal gaps, none at ends
  32. red
  33. reacts to a button click
  34. a class selector
  35. False
  36. the viewport meta tag
  37. ;
  38. packs boxes at the start
  39. blue
  40. p

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