← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 240 · 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.⚖️ 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
  2. 2.🌈 What is the biggest number one colour can have in rgb()? (a) 100 (b) 1000 (c) 99 (d) 255
  3. 3.⚖️ What colour is the text of this element?
    <h1 class="box" id="top">Hi</h1>
    CSS:
    h1 { color: yellow; }
    h1 { color: white; }
    (a) yellow (b) purple (c) white (d) orange
  4. 4.🧩 Which language gives the page structure? (a) CSS (b) HTML (c) JavaScript
  5. 5.⚖️ What colour is the text of this element?
    <h1 class="menu" id="hero">Hi</h1>
    CSS:
    h1 { color: green; }
    h1 { color: blue; }
    (a) blue (b) purple (c) red (d) green
  6. 6.🌈 In #rrggbb, which colour do the first two digits give? (a) black (b) red (c) green (d) blue
  7. 7.🌈 Which colour is rgb(0, 0, 255)? (a) cyan (b) bright green (c) magenta (d) blue
  8. 8.🌈 In #240000 the red part is the hex number 24. What is it as a normal number?
  9. 9.What does background-color do? (a) picks the font style (b) sets the letter colour (c) makes the text bold (d) colours behind the text
  10. 10.✍️ CSS declarations go inside which brackets? (a) ( ) (b) < > (c) [ ] (d) { }
  11. 11.🎯 Can many elements share the same class? (a) Yes (b) No
  12. 12.⚖️ What colour is the text of this element?
    <p class="note" id="end">Hi</p>
    CSS:
    p { color: orange; }
    p { color: purple; }
    (a) green (b) orange (c) purple (d) yellow
  13. 13.⚖️ What colour is the text of this element?
    <h1 class="red" id="main">Hi</h1>
    CSS:
    h1 { color: black; }
    h1 { color: purple; }
    (a) yellow (b) orange (c) black (d) purple
  14. 14.⚖️ What colour is the text of this element?
    <p class="big" id="main">Hi</p>
    CSS:
    p { color: red; }
    .big { color: white; }
    #main { color: purple; }
    (a) black (b) red (c) white (d) purple
  15. 15.🎯 Which element does the selector span style? (a) <span class="note"> (b) <p> (c) <h2 id="main"> (d) <h1 class="note">
  16. 16.✍️ How does a CSS comment start? (a) # (b) // (c) <!-- (d) /*
  17. 17.🎯 Which element does the selector .big style? (a) <h2 class="box"> (b) <h1 class="big"> (c) <h1 id="big"> (d) <h1 class="red">
  18. 18.✍️ Which sign ends each CSS declaration? (a) : (b) ; (c) , (d) .
  19. 19.🎯 Which CSS selector matches this element?
    <div class="menu" id="logo">Hello</div>
    (a) .menu (b) .note (c) span (d) #menu
  20. 20.📱 Responsive design means a page ___. (a) fits every screen (b) is only for laptops (c) never changes (d) has no pictures
  21. 21.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 8px;
      }
    }
  22. 22.🌈 Which colour is rgb(255, 0, 0)? (a) white (b) cyan (c) red (d) black
  23. 23.⚖️ What colour is the text of this element?
    <p class="box" id="hero">Hi</p>
    CSS:
    p { color: purple; }
    #hero { color: red; }
    .box { color: green; }
    (a) green (b) red (c) white (d) purple
  24. 24.What does justify-content: center do? (a) packs boxes at the end (b) packs boxes at the start (c) puts boxes in the middle (d) equal gaps, none at ends
  25. 25.🧩 Which language changes the text size? (a) JavaScript (b) CSS (c) HTML
  26. 26.✍️ How many declarations (property: value pairs) are in this rule?
    h2 {
      font-size: 20px;
    }
  27. 27.🌈 Which colour of light is strongest in rgb(38, 222, 16)? (a) red (b) blue (c) green
  28. 28.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 28px;
      }
    }
  29. 29.📱 The screen is 540px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 16px;
      }
    }
    (a) Yes (b) No
  30. 30.🎯 What kind of selector is .big? (a) an id selector (b) an element selector (c) a class selector
  31. 31.🖌️ How big is the text, in px?
    li {
      text-align: center;
      color: blue;
      font-size: 36px;
      background-color: orange;
    }
  32. 32.🧩 Which language puts a picture on a page? (a) HTML (b) CSS (c) JavaScript
  33. 33.🔍 Which is the odd one out? (a) shows a pop-up message (b) changes the page live (c) gives the page structure (d) checks a quiz answer
  34. 34.✍️ In color: blue; which part is the value? (a) : (b) ; (c) color (d) blue
  35. 35.📱 The screen is 820px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 8px;
      }
    }
    (a) No (b) Yes
  36. 36.📱 max-width: 600px applies when the screen is ___. (a) 600px or narrower (b) turned off (c) 600px or wider (d) exactly 1000px
  37. 37.True or false: #end is an id selector. (a) False (b) True
  38. 38.✍️ How many declarations (property: value pairs) are in this rule?
    h1 {
      padding: 8px;
      font-size: 20px;
      margin: 10px;
      font-style: italic;
    }
  39. 39.📱 min-width: 800px applies when the screen is ___. (a) 800px or wider (b) exactly 100px (c) turned off (d) 800px or narrower
  40. 40.📦 In the box model, which part is space outside the border? (a) content (b) margin (c) border (d) padding

Answer key

  1. the later one
  2. 255
  3. white
  4. HTML
  5. blue
  6. red
  7. blue
  8. 36
  9. colours behind the text
  10. { }
  11. Yes
  12. purple
  13. purple
  14. purple
  15. <span class="note">
  16. /*
  17. <h1 class="big">
  18. ;
  19. .menu
  20. fits every screen
  21. 8
  22. red
  23. red
  24. puts boxes in the middle
  25. CSS
  26. 1
  27. green
  28. 28
  29. No
  30. a class selector
  31. 36
  32. HTML
  33. gives the page structure
  34. blue
  35. No
  36. 600px or narrower
  37. True
  38. 4
  39. 800px or wider
  40. margin

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