← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 200 · 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.🎨 Which tag connects an outside CSS file? (a) <a> (b) <img> (c) <link> (d) <css>
  2. 2.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 180px;
      padding: 5px;
      border: 2px solid black;
      margin: 10px;
    }
  3. 3.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 24px;
      }
    }
  4. 4.🖌️ What colour are the letters?
    li {
      background-color: yellow;
      font-size: 36px;
      text-align: right;
      color: green;
    }
    (a) yellow (b) white (c) green
  5. 5.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 260px;
      padding: 15px;
      border: 5px solid black;
      margin: 0px;
    }
  6. 6.⚖️ What colour is the text of this element?
    <h2 class="red" id="logo">Hi</h2>
    CSS:
    .red { color: green; }
    #logo { color: black; }
    h2 { color: purple; }
    (a) orange (b) green (c) black (d) purple
  7. 7.🔍 Which is the odd one out? (a) reacts to a button click (b) lays out the page (c) checks a quiz answer (d) changes the page live
  8. 8.📦 In the box model, which part is the gap to other boxes? (a) padding (b) border (c) margin (d) content
  9. 9.🎯 What kind of selector is .card? (a) an element selector (b) a class selector (c) an id selector
  10. 10.⚖️ What colour is the text of this element?
    <h1 class="star" id="intro">Hi</h1>
    CSS:
    h1 { color: orange; }
    h1 { color: black; }
    (a) green (b) black (c) orange (d) blue
  11. 11.Which of these does JavaScript do? (a) adds space around boxes (b) counts down a timer (c) gives the page structure (d) puts a picture on a page
  12. 12.🖌️ Where does the text sit on its line?
    h1 {
      font-size: 32px;
      background-color: orange;
      color: green;
      text-align: right;
    }
    (a) in the middle (b) on the right (c) on the left
  13. 13.What does justify-content: flex-start 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
  14. 14.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 270px;
      padding: 20px;
      border: 3px solid black;
      margin: 15px;
    }
  15. 15.🎯 Which sign starts an id selector? (a) @ (b) # (c) . (d) &
  16. 16.⚖️ What colour is the text of this element?
    <h2 class="star" id="intro">Hi</h2>
    CSS:
    .star { color: purple; }
    .star { color: green; }
    (a) white (b) green (c) yellow (d) purple
  17. 17.🌈 Which hex code is red? (a) #ffffff (b) #ff00ff (c) #ff0000 (d) #00ff00
  18. 18.✍️ How does a CSS comment start? (a) // (b) # (c) <!-- (d) /*
  19. 19.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the later one (b) the first one (c) the shorter one (d) neither
  20. 20.✍️ In color: blue; which part is the value? (a) : (b) blue (c) ; (d) color
  21. 21.What does justify-content: space-between do? (a) packs boxes at the end (b) equal gaps, none at ends (c) packs boxes at the start (d) puts boxes in the middle
  22. 22.📱 What does a media query check? (a) the battery level (b) the time of day (c) the page title (d) the screen width
  23. 23.🎯 Can many elements share the same class? (a) Yes (b) No
  24. 24.🌈 Which colour is #000000? (a) red (b) magenta (c) black (d) bright green
  25. 25.✍️ Which property is set to 20px in this rule?
    body {
      font-style: italic;
      font-size: 20px;
      color: red;
    }
    (a) background-color (b) font-size (c) text-align (d) 20px
  26. 26.True or false: #logo is a class selector. (a) True (b) False
  27. 27.🔍 Which is the odd one out? (a) checks a quiz answer (b) makes a form box (c) counts down a timer (d) shows a pop-up message
  28. 28.🌈 What is the biggest number one colour can have in rgb()? (a) 255 (b) 99 (c) 1000 (d) 100
  29. 29.🌈 Hex digits go 0 to 9, then A to which letter? (a) J (b) F (c) G (d) Z
  30. 30.🌈 In #e30000 the red part is the hex number e3. What is it as a normal number?
  31. 31.⚖️ What colour is the text of this element?
    <p class="star" id="top">Hi</p>
    CSS:
    #top { color: blue; }
    #top { color: black; }
    (a) orange (b) black (c) white (d) blue
  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: 70px;
      padding: 10px;
      border: 5px solid black;
      margin: 10px;
    }
  33. 33.🎯 Which element does the selector div style? (a) <div class="menu"> (b) <p class="menu"> (c) <h1 id="top"> (d) <span>
  34. 34.True or false: CSS puts a picture on a page. (a) False (b) True
  35. 35.💪 Which justify-content value equal gaps, none at ends? (a) center (b) flex-end (c) space-between (d) flex-start
  36. 36.Which of these is margin? (a) a solid or dotted edge (b) space outside the border (c) the gap round content (d) the text or picture
  37. 37.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 260px;
      padding: 10px;
      border: 3px solid black;
      margin: 20px;
    }
  38. 38.True or false: JavaScript gives the page structure. (a) False (b) True
  39. 39.🎯 Which element does the selector #end style? (a) <h1 class="end"> (b) <h2 class="menu"> (c) <h1 id="hero"> (d) <h1 id="end">
  40. 40.✍️ Which property is set to red in this rule?
    h2 {
      font-size: 20px;
      color: red;
      font-weight: bold;
      font-style: italic;
    }
    (a) font-size (b) red (c) color (d) text-align

Answer key

  1. <link>
  2. 214
  3. 16
  4. green
  5. 300
  6. black
  7. lays out the page
  8. margin
  9. a class selector
  10. black
  11. counts down a timer
  12. on the right
  13. packs boxes at the start
  14. 316
  15. #
  16. green
  17. #ff0000
  18. /*
  19. the later one
  20. blue
  21. equal gaps, none at ends
  22. the screen width
  23. Yes
  24. black
  25. font-size
  26. False
  27. makes a form box
  28. 255
  29. F
  30. 227
  31. black
  32. 100
  33. <div class="menu">
  34. False
  35. space-between
  36. space outside the border
  37. 326
  38. False
  39. <h1 id="end">
  40. color

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