← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 292 · 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.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 70px;
      padding: 25px;
      border: 5px solid black;
      margin: 5px;
    }
  2. 2.⚖️ What colour is the text of this element?
    <p class="box" id="top">Hi</p>
    CSS:
    p { color: red; }
    .box { color: green; }
    #top { color: blue; }
    (a) red (b) white (c) blue (d) green
  3. 3.🌈 Which colour is rgb(255, 0, 0)? (a) white (b) blue (c) red (d) bright green
  4. 4.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 120px;
      padding: 20px;
      border: 5px solid black;
      margin: 10px;
    }
  5. 5.🎨 Which tag connects an outside CSS file? (a) <img> (b) <a> (c) <css> (d) <link>
  6. 6.🎯 What kind of selector is .big? (a) an id selector (b) an element selector (c) a class selector
  7. 7.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 60px;
      padding: 5px;
      border: 3px solid black;
      margin: 5px;
    }
  8. 8.🌈 In #0000cc the blue part is the hex number cc. What is it as a normal number?
  9. 9.📱 max-width: 600px applies when the screen is ___. (a) exactly 1000px (b) 600px or narrower (c) turned off (d) 600px or wider
  10. 10.💪 Which justify-content value equal gaps, none at ends? (a) flex-end (b) center (c) flex-start (d) space-between
  11. 11.🎯 Which CSS selector matches this element?
    <p class="big" id="top">Hello</p>
    (a) .red (b) p (c) #big (d) #intro
  12. 12.🔍 Which is the odd one out? (a) reacts to a button click (b) checks a quiz answer (c) changes the page live (d) lays out the page
  13. 13.📱 The screen is 1366px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 18px;
      }
    }
    (a) Yes (b) No
  14. 14.🌈 Which hex code is red? (a) #ff00ff (b) #ffffff (c) #00ff00 (d) #ff0000
  15. 15.True or false: #logo is a class selector. (a) False (b) True
  16. 16.🎨 One CSS file can style how many pages? (a) only one image (b) only one word (c) many pages (d) no pages
  17. 17.🎯 Which CSS selector matches this element?
    <span class="note" id="top">Hello</span>
    (a) .big (b) p (c) #intro (d) #top
  18. 18.⚖️ Which selector is the weakest? (a) an element selector (b) an id selector (c) a class selector
  19. 19.✍️ In color: blue; which part is the property? (a) blue (b) color (c) ; (d) :
  20. 20.What does text-align do? (a) sets the letter colour (b) picks the font style (c) centres a heading (d) makes letters bigger
  21. 21.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 14px;
      }
    }
  22. 22.🌈 Which colour of light is strongest in rgb(84, 231, 91)? (a) green (b) red (c) blue
  23. 23.🎯 Which element does the selector #end style? (a) <li class="end"> (b) <li id="end"> (c) <div class="star"> (d) <li id="hero">
  24. 24.🖌️ What colour are the letters?
    p {
      background-color: red;
      font-size: 36px;
      color: yellow;
      text-align: center;
    }
    (a) yellow (b) black (c) red
  25. 25.Which of these is padding? (a) the gap to other boxes (b) the gap round content (c) the text or picture (d) a solid or dotted edge
  26. 26.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 200px;
      padding: 30px;
      border: 5px solid black;
      margin: 15px;
    }
  27. 27.Which of these is the border? (a) the gap round content (b) space inside the border (c) a solid or dotted edge (d) the gap to other boxes
  28. 28.💪 Which flexbox property turns on flexbox? (a) justify-content (b) display: flex (c) align-items (d) flex-direction
  29. 29.🌈 Which colour is rgb(255, 0, 255)? (a) blue (b) white (c) magenta (d) red
  30. 30.⚖️ What colour is the text of this element?
    <h1 class="red" id="main">Hi</h1>
    CSS:
    .red { color: purple; }
    .red { color: blue; }
    (a) purple (b) red (c) blue (d) yellow
  31. 31.📦 In the box model, which part is a solid or dotted edge? (a) border (b) content (c) margin (d) padding
  32. 32.🎯 Which CSS selector matches this element?
    <p class="big" id="main">Hello</p>
    (a) .big (b) #big (c) .red (d) #logo
  33. 33.✍️ What is the selector in this CSS rule?
    h1 {
      color: red;
      font-style: italic;
      font-weight: bold;
    }
    (a) italic (b) color (c) p (d) h1
  34. 34.💪 Which justify-content value puts boxes in the middle? (a) center (b) flex-end (c) flex-start (d) space-between
  35. 35.Which of these is padding? (a) space inside the border (b) the text or picture (c) a solid or dotted edge (d) space outside the border
  36. 36.Which of these does JavaScript do? (a) makes a link (b) reacts to a button click (c) sets colours and fonts (d) adds space around boxes
  37. 37.📦 In the box model, which part is space inside the border? (a) border (b) content (c) margin (d) padding
  38. 38.What does justify-content: flex-end do? (a) packs boxes at the start (b) equal gaps, none at ends (c) packs boxes at the end (d) puts boxes in the middle
  39. 39.What does justify-content: space-between do? (a) packs boxes at the start (b) packs boxes at the end (c) puts boxes in the middle (d) equal gaps, none at ends
  40. 40.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 24px;
      }
    }

Answer key

  1. 130
  2. blue
  3. red
  4. 190
  5. <link>
  6. a class selector
  7. 86
  8. 204
  9. 600px or narrower
  10. space-between
  11. p
  12. lays out the page
  13. No
  14. #ff0000
  15. False
  16. many pages
  17. #top
  18. an element selector
  19. color
  20. centres a heading
  21. 14
  22. green
  23. <li id="end">
  24. yellow
  25. the gap round content
  26. 300
  27. a solid or dotted edge
  28. display: flex
  29. magenta
  30. blue
  31. border
  32. .big
  33. h1
  34. center
  35. space inside the border
  36. reacts to a button click
  37. padding
  38. packs boxes at the end
  39. equal gaps, none at ends
  40. 24

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