← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 862 · 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.📱 min-width: 800px applies when the screen is ___. (a) 800px or narrower (b) exactly 100px (c) turned off (d) 800px or wider
  2. 2.⚖️ What colour is the text of this element?
    <p class="big" id="intro">Hi</p>
    CSS:
    p { color: black; }
    p { color: red; }
    (a) black (b) red (c) blue (d) yellow
  3. 3.⚖️ What colour is the text of this element?
    <p class="box" id="end">Hi</p>
    CSS:
    #end { color: white; }
    #end { color: green; }
    (a) blue (b) orange (c) green (d) white
  4. 4.📱 The screen is 1366px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 14px;
      }
    }
    (a) Yes (b) No
  5. 5.✍️ What value is given to padding in this rule?
    .box {
      padding: 8px;
      width: 300px;
      font-style: italic;
    }
    (a) 8px (b) 2px solid (c) padding (d) bold
  6. 6.⚖️ Which selector is the weakest? (a) an id selector (b) an element selector (c) a class selector
  7. 7.🎯 What kind of selector is #logo? (a) an element selector (b) a class selector (c) an id selector
  8. 8.🖌️ How big is the text, in px?
    li {
      background-color: purple;
      font-size: 20px;
      text-align: center;
      color: yellow;
    }
  9. 9.⚖️ What colour is the text of this element?
    <p class="note" id="hero">Hi</p>
    CSS:
    #hero { color: blue; }
    #hero { color: red; }
    (a) blue (b) white (c) red (d) orange
  10. 10.⚖️ What colour is the text of this element?
    <p class="menu" id="logo">Hi</p>
    CSS:
    .menu { color: red; }
    .menu { color: white; }
    (a) red (b) blue (c) white (d) purple
  11. 11.📱 The screen is 700px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 22px;
      }
    }
    (a) Yes (b) No
  12. 12.True or false: the content is space inside the border. (a) True (b) False
  13. 13.🌈 What is the biggest number one colour can have in rgb()? (a) 99 (b) 100 (c) 1000 (d) 255
  14. 14.✍️ Which sign goes between a property and its value? (a) - (b) : (c) ; (d) =
  15. 15.🎯 Which element does the selector #intro style? (a) <h1 id="main"> (b) <h2 class="red"> (c) <h1 id="intro"> (d) <h1 class="intro">
  16. 16.Which of these is the content? (a) the text or picture (b) the line round the box (c) space inside the border (d) a solid or dotted edge
  17. 17.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 2 (b) 3 (c) 4 (d) 6
  18. 18.✍️ Which property is set to center in this rule?
    .box {
      margin: 10px;
      text-align: center;
    }
    (a) center (b) margin (c) text-align (d) background-color
  19. 19.🖌️ What colour are the letters?
    h1 {
      font-size: 12px;
      color: orange;
      background-color: green;
      text-align: left;
    }
    (a) white (b) green (c) orange
  20. 20.🌈 Which colour is #000000? (a) red (b) bright green (c) white (d) black
  21. 21.True or false: the border is a solid or dotted edge. (a) False (b) True
  22. 22.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 14px;
      }
    }
  23. 23.🎯 What kind of selector is .menu? (a) an id selector (b) a class selector (c) an element selector
  24. 24.💪 Which justify-content value packs boxes at the start? (a) space-between (b) flex-start (c) center (d) flex-end
  25. 25.Which of these does HTML do? (a) shows a pop-up message (b) adds space around boxes (c) rounds box corners (d) makes headings and lists
  26. 26.✍️ What is the selector in this CSS rule?
    .note {
      color: red;
      font-weight: bold;
      font-style: italic;
      background-color: yellow;
    }
    (a) #top (b) bold (c) .note (d) color
  27. 27.✍️ What value is given to border in this rule?
    li {
      border: 2px solid;
      font-size: 20px;
    }
    (a) border (b) italic (c) 2px solid (d) 300px
  28. 28.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 22px;
      }
    }
  29. 29.✍️ What is the selector in this CSS rule?
    .box {
      color: red;
      margin: 10px;
      font-style: italic;
    }
    (a) h2 (b) color (c) 10px (d) .box
  30. 30.Which of these is margin? (a) the gap round content (b) a solid or dotted edge (c) the gap to other boxes (d) space inside the border
  31. 31.True or false: JavaScript rounds box corners. (a) False (b) True
  32. 32.🌈 Which colour is rgb(0, 0, 0)? (a) yellow (b) black (c) red (d) blue
  33. 33.✍️ What is the selector in this CSS rule?
    h2 {
      font-size: 20px;
      color: red;
      width: 300px;
      border: 2px solid;
    }
    (a) red (b) font-size (c) h1 (d) h2
  34. 34.🖌️ Where does the text sit on its line?
    h1 {
      text-align: left;
      color: green;
      font-size: 28px;
      background-color: purple;
    }
    (a) on the right (b) in the middle (c) on the left
  35. 35.⚖️ What colour is the text of this element?
    <h1 class="red" id="intro">Hi</h1>
    CSS:
    h1 { color: black; }
    .red { color: orange; }
    #intro { color: blue; }
    (a) orange (b) white (c) blue (d) black
  36. 36.✍️ What is the selector in this CSS rule?
    #top {
      background-color: yellow;
      font-weight: bold;
      border: 2px solid;
      font-style: italic;
    }
    (a) background-color (b) li (c) #top (d) bold
  37. 37.🔍 Which is the odd one out? (a) rounds box corners (b) changes the text size (c) adds space around boxes (d) makes headings and lists
  38. 38.🎯 Which CSS selector matches this element?
    <span class="star" id="hero">Hello</span>
    (a) .hero (b) span (c) .menu (d) p
  39. 39.🎨 A CSS file usually ends with which extension? (a) .html (b) .js (c) .css (d) .png
  40. 40.⚖️ What colour is the text of this element?
    <p class="box" id="main">Hi</p>
    CSS:
    .box { color: white; }
    p { color: blue; }
    (a) black (b) white (c) purple (d) blue

Answer key

  1. 800px or wider
  2. red
  3. green
  4. No
  5. 8px
  6. an element selector
  7. an id selector
  8. 20
  9. red
  10. white
  11. Yes
  12. False
  13. 255
  14. :
  15. <h1 id="intro">
  16. the text or picture
  17. 3
  18. text-align
  19. orange
  20. black
  21. True
  22. 14
  23. a class selector
  24. flex-start
  25. makes headings and lists
  26. .note
  27. 2px solid
  28. 16
  29. .box
  30. the gap to other boxes
  31. False
  32. black
  33. h2
  34. on the left
  35. blue
  36. #top
  37. makes headings and lists
  38. span
  39. .css
  40. white

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