← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 131 · 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 colour is #ffff00? (a) white (b) yellow (c) red (d) magenta
  2. 2.⚖️ What colour is the text of this element?
    <h2 class="star" id="main">Hi</h2>
    CSS:
    .star { color: green; }
    .star { color: white; }
    (a) blue (b) orange (c) white (d) green
  3. 3.✍️ Which property is set to 10px in this rule?
    #top {
      margin: 10px;
      color: red;
      font-size: 20px;
      padding: 8px;
    }
    (a) 10px (b) padding (c) font-weight (d) margin
  4. 4.📱 max-width: 600px applies when the screen is ___. (a) 600px or narrower (b) 600px or wider (c) turned off (d) exactly 1000px
  5. 5.🌈 In #002500 the green part is the hex number 25. What is it as a normal number?
  6. 6.🌈 Which colour is #ff00ff? (a) red (b) black (c) magenta (d) yellow
  7. 7.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 200px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 60px wide (no margins).
  8. 8.⚖️ What colour is the text of this element?
    <h1 class="box" id="end">Hi</h1>
    CSS:
    #end { color: blue; }
    #end { color: purple; }
    (a) white (b) purple (c) blue (d) orange
  9. 9.What does justify-content: space-between do? (a) packs boxes at the start (b) puts boxes in the middle (c) equal gaps, none at ends (d) packs boxes at the end
  10. 10.🖌️ Where does the text sit on its line?
    h1 {
      color: red;
      font-size: 12px;
      text-align: right;
      background-color: green;
    }
    (a) on the right (b) on the left (c) in the middle
  11. 11.🖌️ What colour is behind the letters?
    li {
      text-align: left;
      background-color: purple;
      color: blue;
      font-size: 16px;
    }
    (a) purple (b) blue (c) white
  12. 12.🎯 What kind of selector is .big? (a) a class selector (b) an element selector (c) an id selector
  13. 13.🎯 Which element does the selector #top style? (a) <h1 class="top"> (b) <h1 id="top"> (c) <h1 id="intro"> (d) <h2 class="menu">
  14. 14.🎨 One CSS file can style how many pages? (a) many pages (b) no pages (c) only one image (d) only one word
  15. 15.✍️ Which property is set to 20px in this rule?
    h1 {
      padding: 8px;
      font-size: 20px;
    }
    (a) background-color (b) font-size (c) 20px (d) text-align
  16. 16.True or false: CSS puts a picture on a page. (a) False (b) True
  17. 17.What does font-family do? (a) centres a heading (b) sets the letter colour (c) picks the font style (d) makes the text bold
  18. 18.✍️ What is the selector in this CSS rule?
    #top {
      padding: 8px;
      font-size: 20px;
    }
    (a) li (b) padding (c) #top (d) 20px
  19. 19.⚖️ What colour is the text of this element?
    <p class="menu" id="top">Hi</p>
    CSS:
    #top { color: black; }
    #top { color: green; }
    (a) blue (b) green (c) black (d) orange
  20. 20.✍️ How does a CSS comment start? (a) /* (b) // (c) <!-- (d) #
  21. 21.🎯 Which CSS selector matches this element?
    <h1 class="star" id="intro">Hello</h1>
    (a) .intro (b) #star (c) #main (d) .star
  22. 22.🖌️ What colour are the letters?
    p {
      background-color: blue;
      font-size: 12px;
      text-align: center;
      color: orange;
    }
    (a) blue (b) orange (c) green
  23. 23.Which of these does JavaScript do? (a) makes headings and lists (b) puts a picture on a page (c) makes a form box (d) shows a pop-up message
  24. 24.🌈 Which colour is rgb(0, 255, 255)? (a) magenta (b) bright green (c) cyan (d) red
  25. 25.🎯 Which element does the selector #intro style? (a) <span class="menu"> (b) <div class="intro"> (c) <div id="main"> (d) <div id="intro">
  26. 26.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 16px;
      }
    }
  27. 27.📱 The screen is 414px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 6px;
      }
    }
    (a) Yes (b) No
  28. 28.🌈 In #006400 the green part is the hex number 64. What is it as a normal number?
  29. 29.🎯 Can many elements share the same class? (a) No (b) Yes
  30. 30.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 230px;
      padding: 5px;
      border: 1px solid black;
      margin: 0px;
    }
  31. 31.🌈 In #0000ce the blue part is the hex number ce. What is it as a normal number?
  32. 32.🌈 Which colour is rgb(0, 255, 0)? (a) magenta (b) bright green (c) yellow (d) blue
  33. 33.🎨 Which tag connects an outside CSS file? (a) <a> (b) <css> (c) <img> (d) <link>
  34. 34.📱 The screen is 820px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 24px;
      }
    }
    (a) Yes (b) No
  35. 35.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 180px;
      justify-content: flex-end;
    }
    Inside are 3 boxes, each 50px wide (no margins).
  36. 36.🔍 Which is the odd one out? (a) makes a form box (b) makes a link (c) puts a picture on a page (d) adds space around boxes
  37. 37.✍️ Which property is set to bold in this rule?
    p {
      background-color: yellow;
      font-weight: bold;
      font-style: italic;
      width: 300px;
    }
    (a) font-weight (b) width (c) bold (d) border
  38. 38.✍️ In color: blue; which part is the property? (a) color (b) blue (c) : (d) ;
  39. 39.⚖️ What colour is the text of this element?
    <h1 class="note" id="intro">Hi</h1>
    CSS:
    #intro { color: red; }
    #intro { color: yellow; }
    (a) purple (b) orange (c) red (d) yellow
  40. 40.🎨 Which attribute adds CSS inside one tag? (a) href (b) alt (c) src (d) style

Answer key

  1. yellow
  2. white
  3. margin
  4. 600px or narrower
  5. 37
  6. magenta
  7. 80
  8. purple
  9. equal gaps, none at ends
  10. on the right
  11. purple
  12. a class selector
  13. <h1 id="top">
  14. many pages
  15. font-size
  16. False
  17. picks the font style
  18. #top
  19. green
  20. /*
  21. .star
  22. orange
  23. shows a pop-up message
  24. cyan
  25. <div id="intro">
  26. 20
  27. Yes
  28. 100
  29. Yes
  30. 242
  31. 206
  32. bright green
  33. <link>
  34. Yes
  35. 30
  36. adds space around boxes
  37. font-weight
  38. color
  39. yellow
  40. style

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