← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 145 · 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 hex code is cyan? (a) #00ffff (b) #ffff00 (c) #0000ff (d) #ff00ff
  2. 2.⚖️ What colour is the text of this element?
    <p class="red" id="top">Hi</p>
    CSS:
    p { color: green; }
    p { color: purple; }
    (a) orange (b) blue (c) purple (d) green
  3. 3.🌈 In #190000 the red part is the hex number 19. What is it as a normal number?
  4. 4.🧩 Which language puts a picture on a page? (a) CSS (b) HTML (c) JavaScript
  5. 5.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 4 (b) 3 (c) 2 (d) 6
  6. 6.🧩 Which language gives the page structure? (a) CSS (b) HTML (c) JavaScript
  7. 7.🖌️ What colour is behind the letters?
    h1 {
      color: yellow;
      font-size: 16px;
      background-color: black;
      text-align: center;
    }
    (a) yellow (b) green (c) black
  8. 8.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 14px;
      }
    }
  9. 9.🌈 In #000055 the blue part is the hex number 55. What is it as a normal number?
  10. 10.🧩 Which language rounds box corners? (a) HTML (b) CSS (c) JavaScript
  11. 11.True or false: HTML changes the text size. (a) False (b) True
  12. 12.⚖️ What colour is the text of this element?
    <h1 class="big" id="logo">Hi</h1>
    CSS:
    h1 { color: red; }
    #logo { color: green; }
    (a) blue (b) green (c) purple (d) red
  13. 13.💪 Which justify-content value equal gaps, none at ends? (a) flex-end (b) center (c) space-between (d) flex-start
  14. 14.🌈 Which colour is #0000ff? (a) bright green (b) black (c) blue (d) magenta
  15. 15.True or false: #hero is a class selector. (a) False (b) True
  16. 16.✍️ How does a CSS comment start? (a) // (b) /* (c) <!-- (d) #
  17. 17.🌈 Which colour is rgb(0, 255, 255)? (a) white (b) cyan (c) black (d) magenta
  18. 18.⚖️ What colour is the text of this element?
    <h1 class="note" id="hero">Hi</h1>
    CSS:
    .note { color: green; }
    .note { color: purple; }
    (a) white (b) purple (c) black (d) green
  19. 19.True or false: HTML sets colours and fonts. (a) True (b) False
  20. 20.✍️ Which sign goes between a property and its value? (a) - (b) : (c) = (d) ;
  21. 21.✍️ What value is given to background-color in this rule?
    p {
      text-align: center;
      color: red;
      background-color: yellow;
    }
    (a) yellow (b) 8px (c) background-color (d) 10px
  22. 22.✍️ How many declarations (property: value pairs) are in this rule?
    h1 {
      font-weight: bold;
      text-align: center;
    }
  23. 23.Which of these does CSS do? (a) changes the page live (b) makes headings and lists (c) puts a picture on a page (d) adds space around boxes
  24. 24.✍️ In color: blue; which part is the value? (a) color (b) ; (c) blue (d) :
  25. 25.Which of these is the content? (a) the line round the box (b) a solid or dotted edge (c) the text or picture (d) the gap round content
  26. 26.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 160px;
      justify-content: space-between;
    }
    Inside are 2 boxes, each 50px wide (no margins).
  27. 27.🎯 What kind of selector is #main? (a) an element selector (b) a class selector (c) an id selector
  28. 28.Which of these is the border? (a) a solid or dotted edge (b) space inside the border (c) space outside the border (d) the gap to other boxes
  29. 29.Which of these does HTML do? (a) shows a pop-up message (b) reacts to a button click (c) puts a picture on a page (d) changes the page live
  30. 30.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 8px;
      }
    }
  31. 31.Which of these does JavaScript do? (a) sets colours and fonts (b) counts down a timer (c) makes headings and lists (d) lays out the page
  32. 32.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 10px;
      }
    }
  33. 33.⚖️ What colour is the text of this element?
    <p class="red" id="logo">Hi</p>
    CSS:
    .red { color: purple; }
    #logo { color: orange; }
    p { color: white; }
    (a) white (b) red (c) orange (d) purple
  34. 34.🎯 Which CSS selector matches this element?
    <div class="menu" id="intro">Hello</div>
    (a) div (b) #menu (c) #main (d) span
  35. 35.🎨 Which tag connects an outside CSS file? (a) <link> (b) <css> (c) <a> (d) <img>
  36. 36.📱 Which tag helps phones show a page at the right size? (a) the hr tag (b) the viewport meta tag (c) the br tag (d) the title tag
  37. 37.⚖️ What colour is the text of this element?
    <p class="star" id="top">Hi</p>
    CSS:
    #top { color: green; }
    .star { color: yellow; }
    p { color: white; }
    (a) blue (b) yellow (c) white (d) green
  38. 38.🎯 Which CSS selector matches this element?
    <h1 class="big" id="main">Hello</h1>
    (a) #big (b) h1 (c) #logo (d) .red
  39. 39.📦 In the box model, which part is the text or picture? (a) content (b) border (c) padding (d) margin
  40. 40.✍️ CSS declarations go inside which brackets? (a) < > (b) { } (c) ( ) (d) [ ]

Answer key

  1. #00ffff
  2. purple
  3. 25
  4. HTML
  5. 3
  6. HTML
  7. black
  8. 12
  9. 85
  10. CSS
  11. False
  12. green
  13. space-between
  14. blue
  15. False
  16. /*
  17. cyan
  18. purple
  19. False
  20. :
  21. yellow
  22. 2
  23. adds space around boxes
  24. blue
  25. the text or picture
  26. 60
  27. an id selector
  28. a solid or dotted edge
  29. puts a picture on a page
  30. 8
  31. counts down a timer
  32. 12
  33. orange
  34. div
  35. <link>
  36. the viewport meta tag
  37. green
  38. h1
  39. content
  40. { }

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