← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 567 · 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 property is set to italic in this rule?
    .note {
      font-style: italic;
      margin: 10px;
      border: 2px solid;
      text-align: center;
    }
    (a) italic (b) font-size (c) color (d) font-style
  2. 2.🌈 Which colour of light is strongest in rgb(63, 173, 110)? (a) red (b) green (c) blue
  3. 3.True or false: JavaScript lays out the page. (a) False (b) True
  4. 4.🖌️ What colour are the letters?
    p {
      background-color: orange;
      text-align: left;
      font-size: 36px;
      color: black;
    }
    (a) orange (b) purple (c) black
  5. 5.⚖️ What colour is the text of this element?
    <p class="box" id="end">Hi</p>
    CSS:
    p { color: black; }
    p { color: yellow; }
    (a) yellow (b) orange (c) green (d) black
  6. 6.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 170px;
      padding: 20px;
      border: 4px solid black;
      margin: 10px;
    }
  7. 7.🎯 Which element does the selector #intro style? (a) <h1 class="menu"> (b) <p id="main"> (c) <p id="intro"> (d) <p class="intro">
  8. 8.✍️ How does a CSS comment start? (a) # (b) /* (c) // (d) <!--
  9. 9.⚖️ What colour is the text of this element?
    <h1 class="note" id="top">Hi</h1>
    CSS:
    h1 { color: yellow; }
    #top { color: green; }
    .note { color: orange; }
    (a) orange (b) black (c) yellow (d) green
  10. 10.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 18px;
      }
    }
  11. 11.True or false: padding is the gap round content. (a) True (b) False
  12. 12.🎯 Which CSS selector matches this element?
    <div class="note" id="main">Hello</div>
    (a) .main (b) div (c) .big (d) #note
  13. 13.🌈 In #rrggbb, which colour do the last two digits give? (a) green (b) blue (c) white (d) red
  14. 14.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 300px;
      padding: 5px;
      border: 5px solid black;
      margin: 15px;
    }
  15. 15.🌈 In #003d00 the green part is the hex number 3d. What is it as a normal number?
  16. 16.⚖️ What colour is the text of this element?
    <h1 class="big" id="end">Hi</h1>
    CSS:
    h1 { color: green; }
    .big { color: orange; }
    #end { color: yellow; }
    (a) orange (b) green (c) yellow (d) black
  17. 17.🌈 Which colour of light is strongest in rgb(23, 240, 135)? (a) red (b) green (c) blue
  18. 18.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 24px;
      }
    }
  19. 19.✍️ Which sign ends each CSS declaration? (a) . (b) ; (c) : (d) ,
  20. 20.⚖️ What colour is the text of this element?
    <p class="big" id="end">Hi</p>
    CSS:
    #end { color: black; }
    p { color: green; }
    (a) green (b) blue (c) yellow (d) black
  21. 21.📱 The screen is 1366px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 20px;
      }
    }
    (a) Yes (b) No
  22. 22.📱 What does a media query check? (a) the time of day (b) the screen width (c) the battery level (d) the page title
  23. 23.✍️ What is the selector in this CSS rule?
    .box {
      padding: 8px;
      font-weight: bold;
      font-style: italic;
    }
    (a) .box (b) h2 (c) bold (d) padding
  24. 24.⚖️ What colour is the text of this element?
    <h2 class="menu" id="hero">Hi</h2>
    CSS:
    #hero { color: white; }
    .menu { color: yellow; }
    (a) blue (b) yellow (c) purple (d) white
  25. 25.🖌️ Which CSS property colours behind the text? (a) font-size (b) font-weight (c) background-color (d) color
  26. 26.🌈 Which colour is #00ffff? (a) cyan (b) black (c) blue (d) red
  27. 27.🌈 What is the biggest number one colour can have in rgb()? (a) 100 (b) 99 (c) 1000 (d) 255
  28. 28.🌈 In #rrggbb, which colour do the first two digits give? (a) black (b) red (c) blue (d) green
  29. 29.🖌️ Which CSS property centres a heading? (a) text-align (b) font-family (c) font-size (d) background-color
  30. 30.True or false: the border is the line round the box. (a) True (b) False
  31. 31.📱 The screen is 414px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 22px;
      }
    }
    (a) Yes (b) No
  32. 32.✍️ CSS declarations go inside which brackets? (a) ( ) (b) < > (c) [ ] (d) { }
  33. 33.🌈 Which colour is rgb(255, 0, 0)? (a) white (b) black (c) red (d) cyan
  34. 34.✍️ How many declarations (property: value pairs) are in this rule?
    #top {
      background-color: yellow;
      color: red;
      width: 300px;
    }
  35. 35.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the first one (b) neither (c) the later one (d) the shorter one
  36. 36.🎯 Which element does the selector h2 style? (a) <li> (b) <h2 class="star"> (c) <div class="star"> (d) <span id="top">
  37. 37.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 2 (b) 3 (c) 4 (d) 6
  38. 38.🖌️ What colour are the letters?
    li {
      background-color: black;
      color: yellow;
      text-align: right;
      font-size: 28px;
    }
    (a) white (b) yellow (c) black
  39. 39.🎯 Which element does the selector #intro style? (a) <li class="big"> (b) <h2 class="intro"> (c) <h2 id="main"> (d) <h2 id="intro">
  40. 40.✍️ Which property is set to 300px in this rule?
    p {
      width: 300px;
      text-align: center;
      padding: 8px;
    }
    (a) color (b) font-style (c) width (d) 300px

Answer key

  1. font-style
  2. green
  3. False
  4. black
  5. yellow
  6. 238
  7. <p id="intro">
  8. /*
  9. green
  10. 18
  11. True
  12. div
  13. blue
  14. 350
  15. 61
  16. yellow
  17. green
  18. 24
  19. ;
  20. black
  21. Yes
  22. the screen width
  23. .box
  24. white
  25. background-color
  26. cyan
  27. 255
  28. red
  29. text-align
  30. True
  31. No
  32. { }
  33. red
  34. 3
  35. the later one
  36. <h2 class="star">
  37. 3
  38. yellow
  39. <h2 id="intro">
  40. width

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