← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 919 · 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 are the letters?
    h2 {
      text-align: left;
      font-size: 12px;
      background-color: blue;
      color: orange;
    }
    (a) white (b) blue (c) orange
  2. 2.🎯 Which CSS selector matches this element?
    <h1 class="note" id="hero">Hello</h1>
    (a) h2 (b) .big (c) #top (d) #hero
  3. 3.True or false: CSS reacts to a button click. (a) False (b) True
  4. 4.✍️ How many declarations (property: value pairs) are in this rule?
    li {
      font-size: 20px;
      text-align: center;
      font-style: italic;
    }
  5. 5.🎯 Which element does the selector li style? (a) <span class="big"> (b) <p id="top"> (c) <div> (d) <li class="big">
  6. 6.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 20px;
      }
    }
    (a) No (b) Yes
  7. 7.📦 In the box model, which part is a solid or dotted edge? (a) padding (b) margin (c) border (d) content
  8. 8.⚖️ Which selector is the weakest? (a) an id selector (b) an element selector (c) a class selector
  9. 9.Which of these does CSS do? (a) counts down a timer (b) lays out the page (c) makes a link (d) checks a quiz answer
  10. 10.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the shorter one (b) neither (c) the first one (d) the later one
  11. 11.🎯 Can many elements share the same class? (a) Yes (b) No
  12. 12.✍️ How many declarations (property: value pairs) are in this rule?
    .box {
      border: 2px solid;
    }
  13. 13.🎨 What does CSS stand for? (a) Computer Style Sheets (b) Colourful Site Styles (c) Cascading Style Sheets (d) Creative Sheet System
  14. 14.🎯 Which CSS selector matches this element?
    <h2 class="note" id="top">Hello</h2>
    (a) #intro (b) #top (c) li (d) .top
  15. 15.⚖️ What colour is the text of this element?
    <p class="star" id="end">Hi</p>
    CSS:
    p { color: black; }
    .star { color: red; }
    (a) yellow (b) red (c) black (d) blue
  16. 16.⚖️ What colour is the text of this element?
    <h2 class="red" id="main">Hi</h2>
    CSS:
    h2 { color: purple; }
    #main { color: blue; }
    (a) blue (b) purple (c) green (d) yellow
  17. 17.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 210px;
      padding: 5px;
      border: 3px solid black;
      margin: 20px;
    }
  18. 18.✍️ How many declarations (property: value pairs) are in this rule?
    #top {
      width: 300px;
      color: red;
      margin: 10px;
    }
  19. 19.🌈 Which colour is rgb(0, 0, 255)? (a) bright green (b) yellow (c) blue (d) white
  20. 20.🎯 Which element does the selector #logo style? (a) <li class="logo"> (b) <div class="note"> (c) <li id="logo"> (d) <li id="end">
  21. 21.📦 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: 5px;
      border: 2px solid black;
      margin: 0px;
    }
  22. 22.🔍 Which is the odd one out? (a) gives the page structure (b) makes a form box (c) makes headings and lists (d) reacts to a button click
  23. 23.✍️ Which sign goes between a property and its value? (a) ; (b) - (c) = (d) :
  24. 24.What does justify-content: center do? (a) equal gaps, none at ends (b) packs boxes at the start (c) packs boxes at the end (d) puts boxes in the middle
  25. 25.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 280px;
      justify-content: flex-end;
    }
    Inside are 2 boxes, each 100px wide (no margins).
  26. 26.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 240px;
      padding: 15px;
      border: 2px solid black;
      margin: 15px;
    }
  27. 27.🌈 In #rrggbb, which colour do the first two digits give? (a) black (b) blue (c) red (d) green
  28. 28.🎯 Which CSS selector matches this element?
    <h2 class="menu" id="intro">Hello</h2>
    (a) #main (b) .note (c) #menu (d) .menu
  29. 29.⚖️ What colour is the text of this element?
    <h2 class="star" id="main">Hi</h2>
    CSS:
    h2 { color: red; }
    #main { color: black; }
    (a) white (b) green (c) black (d) red
  30. 30.What does font-size do? (a) picks the font style (b) centres a heading (c) makes letters bigger (d) makes the text bold
  31. 31.What does justify-content: flex-end do? (a) puts boxes in the middle (b) packs boxes at the end (c) packs boxes at the start (d) equal gaps, none at ends
  32. 32.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 90px;
      padding: 15px;
      border: 5px solid black;
      margin: 0px;
    }
  33. 33.🎯 How many elements on a page should have the same id? (a) 2 (b) any number (c) 5 (d) 1
  34. 34.What does justify-content: space-between do? (a) packs boxes at the end (b) packs boxes at the start (c) puts boxes in the middle (d) equal gaps, none at ends
  35. 35.True or false: #hero is a class selector. (a) True (b) False
  36. 36.🖌️ How big is the text, in px?
    li {
      background-color: black;
      text-align: center;
      font-size: 40px;
      color: yellow;
    }
  37. 37.🌈 Which colour of light is strongest in rgb(208, 94, 13)? (a) blue (b) red (c) green
  38. 38.⚖️ What colour is the text of this element?
    <p class="menu" id="main">Hi</p>
    CSS:
    p { color: yellow; }
    p { color: orange; }
    (a) orange (b) white (c) yellow (d) purple
  39. 39.🎨 A CSS file usually ends with which extension? (a) .js (b) .css (c) .html (d) .png
  40. 40.🌈 Which colour is rgb(255, 255, 255)? (a) yellow (b) blue (c) red (d) white

Answer key

  1. orange
  2. #hero
  3. False
  4. 3
  5. <li class="big">
  6. Yes
  7. border
  8. an element selector
  9. lays out the page
  10. the later one
  11. Yes
  12. 1
  13. Cascading Style Sheets
  14. #top
  15. red
  16. blue
  17. 226
  18. 3
  19. blue
  20. <li id="logo">
  21. 294
  22. reacts to a button click
  23. :
  24. puts boxes in the middle
  25. 80
  26. 304
  27. red
  28. .menu
  29. black
  30. makes letters bigger
  31. packs boxes at the end
  32. 130
  33. 1
  34. equal gaps, none at ends
  35. False
  36. 40
  37. red
  38. orange
  39. .css
  40. white

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