← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 544 · 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.🎯 Can many elements share the same class? (a) Yes (b) No
  2. 2.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 12px;
      }
    }
    (a) Yes (b) No
  3. 3.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 20px;
      }
    }
  4. 4.⚖️ Which selector is the strongest? (a) an id selector (b) an element selector (c) a class selector
  5. 5.✍️ How does a CSS comment start? (a) // (b) <!-- (c) # (d) /*
  6. 6.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 380px;
      justify-content: flex-start;
    }
    Inside are 4 boxes, each 80px wide (no margins).
  7. 7.✍️ How many declarations (property: value pairs) are in this rule?
    .box {
      color: red;
      border: 2px solid;
    }
  8. 8.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 80px;
      padding: 5px;
      border: 3px solid black;
      margin: 5px;
    }
  9. 9.🎨 One CSS file can style how many pages? (a) no pages (b) only one word (c) many pages (d) only one image
  10. 10.🎯 What kind of selector is li? (a) an id selector (b) a class selector (c) an element selector
  11. 11.✍️ How many declarations (property: value pairs) are in this rule?
    body {
      width: 300px;
      color: red;
      font-style: italic;
    }
  12. 12.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the first one (b) the shorter one (c) neither (d) the later one
  13. 13.⚖️ What colour is the text of this element?
    <h1 class="red" id="intro">Hi</h1>
    CSS:
    #intro { color: blue; }
    #intro { color: black; }
    (a) orange (b) black (c) blue (d) purple
  14. 14.True or false: HTML makes a link. (a) False (b) True
  15. 15.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 190px;
      justify-content: flex-end;
    }
    Inside are 2 boxes, each 80px wide (no margins).
  16. 16.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 250px;
      justify-content: flex-end;
    }
    Inside are 3 boxes, each 80px wide (no margins).
  17. 17.🎯 Which element does the selector p style? (a) <h2 class="big"> (b) <li id="intro"> (c) <p class="big"> (d) <h1>
  18. 18.What does justify-content: flex-end do? (a) packs boxes at the end (b) equal gaps, none at ends (c) puts boxes in the middle (d) packs boxes at the start
  19. 19.🎯 Which element does the selector p style? (a) <li id="logo"> (b) <h2 class="box"> (c) <p class="box"> (d) <h1>
  20. 20.✍️ What value is given to width in this rule?
    li {
      width: 300px;
      background-color: yellow;
      border: 2px solid;
      margin: 10px;
    }
    (a) red (b) width (c) italic (d) 300px
  21. 21.⚖️ What colour is the text of this element?
    <p class="big" id="end">Hi</p>
    CSS:
    .big { color: purple; }
    .big { color: blue; }
    (a) orange (b) blue (c) purple (d) white
  22. 22.🔍 Which is the odd one out? (a) shows a pop-up message (b) rounds box corners (c) lays out the page (d) sets colours and fonts
  23. 23.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 14px;
      }
    }
    (a) No (b) Yes
  24. 24.📱 max-width: 600px applies when the screen is ___. (a) exactly 1000px (b) 600px or wider (c) turned off (d) 600px or narrower
  25. 25.🖌️ How big is the text, in px?
    p {
      color: red;
      text-align: left;
      font-size: 12px;
      background-color: blue;
    }
  26. 26.🧩 Which language reacts to a button click? (a) JavaScript (b) CSS (c) HTML
  27. 27.True or false: CSS puts a picture on a page. (a) False (b) True
  28. 28.🎯 Which CSS selector matches this element?
    <li class="box" id="main">Hello</li>
    (a) li (b) .star (c) #box (d) .main
  29. 29.✍️ Which property is set to 20px in this rule?
    body {
      font-size: 20px;
      text-align: center;
    }
    (a) text-align (b) background-color (c) 20px (d) font-size
  30. 30.🎯 Which sign starts an id selector? (a) # (b) & (c) @ (d) .
  31. 31.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 260px;
      justify-content: center;
    }
    Inside are 4 boxes, each 50px wide (no margins).
  32. 32.What does color do? (a) sets the letter colour (b) makes the text bold (c) makes letters bigger (d) centres a heading
  33. 33.🖌️ What colour is behind the letters?
    h1 {
      font-size: 24px;
      text-align: left;
      background-color: blue;
      color: orange;
    }
    (a) blue (b) orange (c) green
  34. 34.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 16px;
      }
    }
  35. 35.📱 What does a media query check? (a) the battery level (b) the page title (c) the time of day (d) the screen width
  36. 36.📱 Responsive design means a page ___. (a) is only for laptops (b) never changes (c) fits every screen (d) has no pictures
  37. 37.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 210px;
      justify-content: flex-start;
    }
    Inside are 3 boxes, each 50px wide (no margins).
  38. 38.Which of these does HTML do? (a) adds space around boxes (b) lays out the page (c) shows a pop-up message (d) gives the page structure
  39. 39.Which of these does CSS do? (a) shows a pop-up message (b) gives the page structure (c) counts down a timer (d) adds space around boxes
  40. 40.🎨 Which tag connects an outside CSS file? (a) <link> (b) <css> (c) <img> (d) <a>

Answer key

  1. Yes
  2. Yes
  3. 20
  4. an id selector
  5. /*
  6. 60
  7. 2
  8. 96
  9. many pages
  10. an element selector
  11. 3
  12. the later one
  13. black
  14. True
  15. 30
  16. 10
  17. <p class="big">
  18. packs boxes at the end
  19. <p class="box">
  20. 300px
  21. blue
  22. shows a pop-up message
  23. Yes
  24. 600px or narrower
  25. 12
  26. JavaScript
  27. False
  28. li
  29. font-size
  30. #
  31. 30
  32. sets the letter colour
  33. blue
  34. 16
  35. the screen width
  36. fits every screen
  37. 60
  38. gives the page structure
  39. adds space around boxes
  40. <link>

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