← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 419 · 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 value is given to text-align in this rule?
    li {
      border: 2px solid;
      text-align: center;
    }
    (a) 10px (b) text-align (c) center (d) yellow
  2. 2.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 12px;
      }
    }
  3. 3.🌈 In #00008a the blue part is the hex number 8a. What is it as a normal number?
  4. 4.🖌️ What colour are the letters?
    h1 {
      background-color: orange;
      text-align: right;
      color: green;
      font-size: 40px;
    }
    (a) green (b) blue (c) orange
  5. 5.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 180px;
      padding: 30px;
      border: 4px solid black;
      margin: 5px;
    }
  6. 6.What does justify-content: center do? (a) puts boxes in the middle (b) equal gaps, none at ends (c) packs boxes at the start (d) packs boxes at the end
  7. 7.⚖️ What colour is the text of this element?
    <h1 class="menu" id="logo">Hi</h1>
    CSS:
    h1 { color: red; }
    #logo { color: purple; }
    (a) red (b) orange (c) purple (d) white
  8. 8.⚖️ Which selector is the weakest? (a) a class selector (b) an id selector (c) an element selector
  9. 9.🌈 Which colour is #ff0000? (a) magenta (b) yellow (c) black (d) red
  10. 10.🎯 Which element does the selector h1 style? (a) <div id="top"> (b) <h2> (c) <li class="menu"> (d) <h1 class="menu">
  11. 11.💪 Which flexbox property turns on flexbox? (a) flex-direction (b) gap (c) justify-content (d) display: flex
  12. 12.✍️ Which sign goes between a property and its value? (a) - (b) ; (c) : (d) =
  13. 13.🎯 Which element does the selector li style? (a) <li class="red"> (b) <div> (c) <span class="red"> (d) <p id="logo">
  14. 14.📱 Responsive design means a page ___. (a) is only for laptops (b) fits every screen (c) never changes (d) has no pictures
  15. 15.⚖️ Which selector is the strongest? (a) an element selector (b) an id selector (c) a class selector
  16. 16.📱 The screen is 540px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 24px;
      }
    }
    (a) Yes (b) No
  17. 17.📱 The screen is 414px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 16px;
      }
    }
    (a) Yes (b) No
  18. 18.⚖️ What colour is the text of this element?
    <p class="box" id="logo">Hi</p>
    CSS:
    p { color: black; }
    p { color: red; }
    (a) white (b) black (c) red (d) orange
  19. 19.Which of these is padding? (a) the gap to other boxes (b) a solid or dotted edge (c) space inside the border (d) the line round the box
  20. 20.⚖️ What colour is the text of this element?
    <p class="box" id="top">Hi</p>
    CSS:
    .box { color: yellow; }
    .box { color: purple; }
    (a) white (b) yellow (c) red (d) purple
  21. 21.🎯 Which CSS selector matches this element?
    <p class="menu" id="end">Hello</p>
    (a) #menu (b) .note (c) #end (d) .end
  22. 22.✍️ How does a CSS comment start? (a) <!-- (b) // (c) /* (d) #
  23. 23.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 240px;
      padding: 15px;
      border: 4px solid black;
      margin: 0px;
    }
  24. 24.🖌️ Where does the text sit on its line?
    h2 {
      font-size: 36px;
      text-align: right;
      color: blue;
      background-color: black;
    }
    (a) in the middle (b) on the left (c) on the right
  25. 25.🧩 Which language puts a picture on a page? (a) JavaScript (b) CSS (c) HTML
  26. 26.🎯 Which element does the selector .red style? (a) <li class="star"> (b) <h2 class="red"> (c) <h2 class="box"> (d) <h2 id="red">
  27. 27.⚖️ What colour is the text of this element?
    <p class="big" id="top">Hi</p>
    CSS:
    #top { color: yellow; }
    #top { color: red; }
    (a) green (b) red (c) yellow (d) orange
  28. 28.✍️ What value is given to background-color in this rule?
    body {
      background-color: yellow;
      border: 2px solid;
      width: 300px;
    }
    (a) background-color (b) yellow (c) 8px (d) 10px
  29. 29.📱 The screen is 820px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 28px;
      }
    }
    (a) No (b) Yes
  30. 30.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 10px;
      }
    }
  31. 31.Which of these does HTML do? (a) gives the page structure (b) changes the text size (c) changes the page live (d) lays out the page
  32. 32.✍️ How many declarations (property: value pairs) are in this rule?
    p {
      text-align: center;
      margin: 10px;
      font-style: italic;
      background-color: yellow;
    }
  33. 33.💪 Which justify-content value packs boxes at the start? (a) center (b) flex-end (c) space-between (d) flex-start
  34. 34.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 22px;
      }
    }
  35. 35.💪 Which flexbox property sets space between boxes? (a) display: flex (b) gap (c) align-items (d) flex-direction
  36. 36.🎯 Which CSS selector matches this element?
    <div class="box" id="top">Hello</div>
    (a) .box (b) #box (c) .top (d) .star
  37. 37.🎯 Which CSS selector matches this element?
    <h2 class="red" id="hero">Hello</h2>
    (a) .red (b) .box (c) .hero (d) li
  38. 38.📱 The screen is 1100px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 6px;
      }
    }
    (a) No (b) Yes
  39. 39.True or false: CSS counts down a timer. (a) True (b) False
  40. 40.📱 The screen is 540px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 20px;
      }
    }
    (a) Yes (b) No

Answer key

  1. center
  2. 12
  3. 138
  4. green
  5. 258
  6. puts boxes in the middle
  7. purple
  8. an element selector
  9. red
  10. <h1 class="menu">
  11. display: flex
  12. :
  13. <li class="red">
  14. fits every screen
  15. an id selector
  16. Yes
  17. Yes
  18. red
  19. space inside the border
  20. purple
  21. #end
  22. /*
  23. 278
  24. on the right
  25. HTML
  26. <h2 class="red">
  27. red
  28. yellow
  29. Yes
  30. 10
  31. gives the page structure
  32. 4
  33. flex-start
  34. 24
  35. gap
  36. .box
  37. .red
  38. No
  39. False
  40. No

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