← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 885 · 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 much space across (px) does this box take in all, margin included?
    .box {
      width: 140px;
      padding: 5px;
      border: 1px solid black;
      margin: 5px;
    }
  2. 2.Which of these does HTML do? (a) sets colours and fonts (b) changes the page live (c) shows a pop-up message (d) makes a form box
  3. 3.💪 Which justify-content value packs boxes at the start? (a) center (b) space-between (c) flex-end (d) flex-start
  4. 4.⚖️ Which selector is the weakest? (a) an id selector (b) a class selector (c) an element selector
  5. 5.🖌️ Which CSS property makes letters bigger? (a) background-color (b) font-size (c) text-align (d) color
  6. 6.⚖️ What colour is the text of this element?
    <p class="red" id="hero">Hi</p>
    CSS:
    #hero { color: yellow; }
    p { color: white; }
    (a) white (b) yellow (c) orange (d) green
  7. 7.🧩 Which language makes headings and lists? (a) JavaScript (b) CSS (c) HTML
  8. 8.True or false: the border is the line round the box. (a) True (b) False
  9. 9.🌈 In #000001 the blue part is the hex number 01. What is it as a normal number?
  10. 10.🖌️ What colour is behind the letters?
    p {
      background-color: blue;
      font-size: 28px;
      color: white;
      text-align: right;
    }
    (a) purple (b) white (c) blue
  11. 11.🌈 In #000028 the blue part is the hex number 28. What is it as a normal number?
  12. 12.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 22px;
      }
    }
  13. 13.True or false: JavaScript makes a form box. (a) True (b) False
  14. 14.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 130px;
      padding: 5px;
      border: 4px solid black;
      margin: 10px;
    }
  15. 15.What does color do? (a) sets the letter colour (b) centres a heading (c) makes letters bigger (d) makes the text bold
  16. 16.🖌️ What colour are the letters?
    h2 {
      font-size: 16px;
      text-align: left;
      color: green;
      background-color: red;
    }
    (a) orange (b) red (c) green
  17. 17.What does justify-content: flex-start do? (a) equal gaps, none at ends (b) puts boxes in the middle (c) packs boxes at the start (d) packs boxes at the end
  18. 18.✍️ In color: blue; which part is the value? (a) : (b) ; (c) blue (d) color
  19. 19.🌈 Which colour is #ffffff? (a) magenta (b) black (c) white (d) blue
  20. 20.🧩 Which language lays out the page? (a) JavaScript (b) HTML (c) CSS
  21. 21.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 18px;
      }
    }
  22. 22.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 12px;
      }
    }
    (a) Yes (b) No
  23. 23.✍️ What value is given to margin in this rule?
    h1 {
      font-size: 20px;
      border: 2px solid;
      width: 300px;
      margin: 10px;
    }
    (a) 10px (b) bold (c) 8px (d) margin
  24. 24.✍️ Which property is set to center in this rule?
    h1 {
      margin: 10px;
      text-align: center;
      font-weight: bold;
    }
    (a) margin (b) background-color (c) center (d) text-align
  25. 25.📱 The screen is 820px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 16px;
      }
    }
    (a) Yes (b) No
  26. 26.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 16px;
      }
    }
  27. 27.📱 The screen is 700px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 8px;
      }
    }
    (a) No (b) Yes
  28. 28.✍️ How many declarations (property: value pairs) are in this rule?
    h2 {
      margin: 10px;
      font-weight: bold;
    }
  29. 29.📦 In the box model, which part is the text or picture? (a) border (b) margin (c) content (d) padding
  30. 30.✍️ How many declarations (property: value pairs) are in this rule?
    h1 {
      font-size: 20px;
      background-color: yellow;
    }
  31. 31.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 8px;
      }
    }
  32. 32.📱 Responsive design means a page ___. (a) has no pictures (b) is only for laptops (c) fits every screen (d) never changes
  33. 33.🖌️ Where does the text sit on its line?
    h1 {
      font-size: 40px;
      background-color: blue;
      text-align: left;
      color: red;
    }
    (a) on the left (b) on the right (c) in the middle
  34. 34.⚖️ What colour is the text of this element?
    <p class="big" id="intro">Hi</p>
    CSS:
    #intro { color: purple; }
    p { color: red; }
    (a) white (b) purple (c) green (d) red
  35. 35.Which of these is padding? (a) space outside the border (b) the gap round content (c) the gap to other boxes (d) the line round the box
  36. 36.True or false: the border is a solid or dotted edge. (a) False (b) True
  37. 37.✍️ Which property is set to 10px in this rule?
    p {
      padding: 8px;
      margin: 10px;
    }
    (a) 10px (b) font-weight (c) margin (d) padding
  38. 38.📱 The screen is 820px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 10px;
      }
    }
    (a) Yes (b) No
  39. 39.🌈 Which colour is rgb(0, 255, 255)? (a) magenta (b) bright green (c) black (d) cyan
  40. 40.🌈 Which colour of light is strongest in rgb(85, 210, 114)? (a) blue (b) green (c) red

Answer key

  1. 162
  2. makes a form box
  3. flex-start
  4. an element selector
  5. font-size
  6. yellow
  7. HTML
  8. True
  9. 1
  10. blue
  11. 40
  12. 22
  13. False
  14. 168
  15. sets the letter colour
  16. green
  17. packs boxes at the start
  18. blue
  19. white
  20. CSS
  21. 18
  22. Yes
  23. 10px
  24. text-align
  25. No
  26. 16
  27. Yes
  28. 2
  29. content
  30. 2
  31. 8
  32. fits every screen
  33. on the left
  34. purple
  35. the gap round content
  36. True
  37. margin
  38. No
  39. cyan
  40. green

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