← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 518 · 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 language makes a form box? (a) JavaScript (b) CSS (c) HTML
  2. 2.🔍 Which is the odd one out? (a) adds space around boxes (b) rounds box corners (c) changes the text size (d) changes the page live
  3. 3.🧩 Which language gives the page structure? (a) HTML (b) CSS (c) JavaScript
  4. 4.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 200px;
      padding: 20px;
      border: 1px solid black;
      margin: 10px;
    }
  5. 5.✍️ How many declarations (property: value pairs) are in this rule?
    li {
      font-weight: bold;
      text-align: center;
    }
  6. 6.⚖️ What colour is the text of this element?
    <h2 class="menu" id="end">Hi</h2>
    CSS:
    h2 { color: red; }
    .menu { color: green; }
    (a) orange (b) blue (c) red (d) green
  7. 7.🎯 What kind of selector is li? (a) an id selector (b) a class selector (c) an element selector
  8. 8.🖌️ Where does the text sit on its line?
    h1 {
      color: orange;
      text-align: center;
      background-color: yellow;
      font-size: 12px;
    }
    (a) on the left (b) on the right (c) in the middle
  9. 9.✍️ Which sign goes between a property and its value? (a) ; (b) - (c) : (d) =
  10. 10.✍️ How many declarations (property: value pairs) are in this rule?
    p {
      font-size: 20px;
    }
  11. 11.✍️ In color: blue; which part is the value? (a) color (b) blue (c) : (d) ;
  12. 12.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 18px;
      }
    }
  13. 13.True or false: .star is a class selector. (a) True (b) False
  14. 14.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 200px;
      padding: 30px;
      border: 4px solid black;
      margin: 0px;
    }
  15. 15.📱 min-width: 800px applies when the screen is ___. (a) 800px or wider (b) exactly 100px (c) turned off (d) 800px or narrower
  16. 16.What does background-color do? (a) sets the letter colour (b) centres a heading (c) colours behind the text (d) makes the text bold
  17. 17.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 2 (b) 4 (c) 3 (d) 6
  18. 18.⚖️ What colour is the text of this element?
    <h1 class="red" id="top">Hi</h1>
    CSS:
    #top { color: yellow; }
    h1 { color: green; }
    (a) green (b) yellow (c) orange (d) red
  19. 19.🌈 In #00009d the blue part is the hex number 9d. What is it as a normal number?
  20. 20.🖌️ How big is the text, in px?
    h2 {
      text-align: center;
      font-size: 32px;
      background-color: yellow;
      color: green;
    }
  21. 21.True or false: JavaScript makes headings and lists. (a) True (b) False
  22. 22.🌈 Which hex code is blue? (a) #ffff00 (b) #ff0000 (c) #000000 (d) #0000ff
  23. 23.🎯 Which CSS selector matches this element?
    <span class="big" id="top">Hello</span>
    (a) .top (b) span (c) #intro (d) .red
  24. 24.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 16px;
      }
    }
  25. 25.What does color do? (a) colours behind the text (b) makes letters bigger (c) centres a heading (d) sets the letter colour
  26. 26.📦 In the box model, which part is the text or picture? (a) padding (b) border (c) content (d) margin
  27. 27.📱 max-width: 600px applies when the screen is ___. (a) exactly 1000px (b) 600px or narrower (c) turned off (d) 600px or wider
  28. 28.🖌️ Where does the text sit on its line?
    h2 {
      background-color: red;
      text-align: center;
      color: orange;
      font-size: 40px;
    }
    (a) in the middle (b) on the left (c) on the right
  29. 29.🖌️ Where does the text sit on its line?
    h2 {
      color: red;
      text-align: right;
      font-size: 32px;
      background-color: green;
    }
    (a) on the left (b) on the right (c) in the middle
  30. 30.What does justify-content: center do? (a) packs boxes at the end (b) puts boxes in the middle (c) packs boxes at the start (d) equal gaps, none at ends
  31. 31.🖌️ What colour are the letters?
    h2 {
      text-align: center;
      font-size: 36px;
      color: red;
      background-color: orange;
    }
    (a) red (b) blue (c) orange
  32. 32.🎯 Which element does the selector .note style? (a) <h1 class="note"> (b) <h1 id="note"> (c) <h2 class="red"> (d) <h1 class="big">
  33. 33.⚖️ Which selector is the strongest? (a) an element selector (b) a class selector (c) an id selector
  34. 34.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 20px;
      }
    }
  35. 35.Which of these does HTML do? (a) counts down a timer (b) sets colours and fonts (c) shows a pop-up message (d) makes headings and lists
  36. 36.📱 Which tag helps phones show a page at the right size? (a) the viewport meta tag (b) the hr tag (c) the title tag (d) the br tag
  37. 37.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 280px;
      justify-content: flex-end;
    }
    Inside are 2 boxes, each 100px wide (no margins).
  38. 38.🎯 Can many elements share the same class? (a) Yes (b) No
  39. 39.🎨 One CSS file can style how many pages? (a) only one word (b) many pages (c) no pages (d) only one image
  40. 40.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 240px;
      justify-content: flex-start;
    }
    Inside are 4 boxes, each 50px wide (no margins).

Answer key

  1. HTML
  2. changes the page live
  3. HTML
  4. 262
  5. 2
  6. green
  7. an element selector
  8. in the middle
  9. :
  10. 1
  11. blue
  12. 18
  13. True
  14. 268
  15. 800px or wider
  16. colours behind the text
  17. 3
  18. yellow
  19. 157
  20. 32
  21. False
  22. #0000ff
  23. span
  24. 16
  25. sets the letter colour
  26. content
  27. 600px or narrower
  28. in the middle
  29. on the right
  30. puts boxes in the middle
  31. red
  32. <h1 class="note">
  33. an id selector
  34. 24
  35. makes headings and lists
  36. the viewport meta tag
  37. 80
  38. Yes
  39. many pages
  40. 40

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