← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 61 · 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 is the odd one out? (a) changes the page live (b) reacts to a button click (c) sets colours and fonts (d) counts down a timer
  2. 2.✍️ Which property is set to italic in this rule?
    h2 {
      border: 2px solid;
      font-style: italic;
    }
    (a) font-style (b) font-size (c) color (d) italic
  3. 3.🌈 In #rrggbb, which colour do the last two digits give? (a) green (b) red (c) white (d) blue
  4. 4.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the shorter one (b) the first one (c) neither (d) the later one
  5. 5.True or false: the content is the line round the box. (a) False (b) True
  6. 6.🌈 Which colour of light is strongest in rgb(128, 107, 254)? (a) red (b) blue (c) green
  7. 7.🌈 Which colour of light is strongest in rgb(133, 15, 169)? (a) red (b) green (c) blue
  8. 8.📱 The screen is 1366px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 22px;
      }
    }
    (a) Yes (b) No
  9. 9.✍️ What value is given to width in this rule?
    h1 {
      background-color: yellow;
      width: 300px;
      border: 2px solid;
      padding: 8px;
    }
    (a) 300px (b) width (c) red (d) italic
  10. 10.🧩 Which language makes headings and lists? (a) CSS (b) JavaScript (c) HTML
  11. 11.📦 In the box model, which part is a solid or dotted edge? (a) margin (b) border (c) content (d) padding
  12. 12.🎯 Which CSS selector matches this element?
    <h1 class="box" id="intro">Hello</h1>
    (a) h1 (b) .star (c) .intro (d) #box
  13. 13.Which of these does HTML do? (a) shows a pop-up message (b) changes the text size (c) sets colours and fonts (d) puts a picture on a page
  14. 14.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 310px;
      justify-content: flex-end;
    }
    Inside are 3 boxes, each 100px wide (no margins).
  15. 15.📦 In the box model, which part is space outside the border? (a) border (b) padding (c) margin (d) content
  16. 16.⚖️ What colour is the text of this element?
    <p class="star" id="top">Hi</p>
    CSS:
    p { color: white; }
    .star { color: blue; }
    #top { color: orange; }
    (a) white (b) red (c) orange (d) blue
  17. 17.True or false: .note is an element selector. (a) True (b) False
  18. 18.✍️ What is the selector in this CSS rule?
    p {
      color: red;
      padding: 8px;
    }
    (a) p (b) color (c) 8px (d) .note
  19. 19.🎨 A CSS file usually ends with which extension? (a) .html (b) .js (c) .css (d) .png
  20. 20.✍️ In color: blue; which part is the value? (a) : (b) blue (c) ; (d) color
  21. 21.True or false: .big is an id selector. (a) True (b) False
  22. 22.💪 Which justify-content value equal gaps, none at ends? (a) center (b) space-between (c) flex-start (d) flex-end
  23. 23.⚖️ Which selector is the weakest? (a) a class selector (b) an id selector (c) an element selector
  24. 24.✍️ Which property is set to center in this rule?
    h2 {
      margin: 10px;
      font-size: 20px;
      text-align: center;
      width: 300px;
    }
    (a) background-color (b) margin (c) center (d) text-align
  25. 25.✍️ CSS declarations go inside which brackets? (a) [ ] (b) < > (c) ( ) (d) { }
  26. 26.🎨 Which tag connects an outside CSS file? (a) <img> (b) <css> (c) <a> (d) <link>
  27. 27.🌈 In #000100 the green part is the hex number 01. What is it as a normal number?
  28. 28.⚖️ What colour is the text of this element?
    <p class="note" id="main">Hi</p>
    CSS:
    .note { color: red; }
    .note { color: green; }
    (a) white (b) blue (c) red (d) green
  29. 29.💪 Which justify-content value packs boxes at the start? (a) flex-start (b) flex-end (c) space-between (d) center
  30. 30.🌈 Which colour is rgb(255, 0, 255)? (a) bright green (b) magenta (c) yellow (d) white
  31. 31.🎯 Which CSS selector matches this element?
    <div class="star" id="top">Hello</div>
    (a) #star (b) span (c) #intro (d) #top
  32. 32.What does justify-content: flex-start do? (a) puts boxes in the middle (b) packs boxes at the end (c) packs boxes at the start (d) equal gaps, none at ends
  33. 33.🎯 Which element does the selector #top style? (a) <h1 class="top"> (b) <h2 class="box"> (c) <h1 id="top"> (d) <h1 id="intro">
  34. 34.🎯 What kind of selector is .note? (a) an element selector (b) a class selector (c) an id selector
  35. 35.🎨 Which tag holds CSS inside the head? (a) <script> (b) <css> (c) <style> (d) <body>
  36. 36.🎯 What kind of selector is #end? (a) a class selector (b) an id selector (c) an element selector
  37. 37.What does font-size do? (a) centres a heading (b) makes letters bigger (c) picks the font style (d) makes the text bold
  38. 38.⚖️ Which selector is the strongest? (a) an element selector (b) an id selector (c) a class selector
  39. 39.✍️ What is the selector in this CSS rule?
    h1 {
      color: red;
      text-align: center;
    }
    (a) center (b) h1 (c) color (d) p
  40. 40.True or false: the content is space outside the border. (a) False (b) True

Answer key

  1. sets colours and fonts
  2. font-style
  3. blue
  4. the later one
  5. False
  6. blue
  7. blue
  8. Yes
  9. 300px
  10. HTML
  11. border
  12. h1
  13. puts a picture on a page
  14. 10
  15. margin
  16. orange
  17. False
  18. p
  19. .css
  20. blue
  21. False
  22. space-between
  23. an element selector
  24. text-align
  25. { }
  26. <link>
  27. 1
  28. green
  29. flex-start
  30. magenta
  31. #top
  32. packs boxes at the start
  33. <h1 id="top">
  34. a class selector
  35. <style>
  36. an id selector
  37. makes letters bigger
  38. an id selector
  39. h1
  40. False

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