← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 959 · 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 shorter one (b) the later one (c) the first one (d) neither
  2. 2.🌈 Which hex code is magenta? (a) #0000ff (b) #00ffff (c) #ffff00 (d) #ff00ff
  3. 3.✍️ Which property is set to italic in this rule?
    .note {
      text-align: center;
      font-style: italic;
    }
    (a) font-size (b) italic (c) color (d) font-style
  4. 4.✍️ CSS declarations go inside which brackets? (a) [ ] (b) ( ) (c) { } (d) < >
  5. 5.🖌️ What colour is behind the letters?
    p {
      text-align: left;
      font-size: 12px;
      color: blue;
      background-color: orange;
    }
    (a) orange (b) blue (c) yellow
  6. 6.True or false: li is an id selector. (a) False (b) True
  7. 7.🖌️ What colour is behind the letters?
    p {
      text-align: center;
      background-color: orange;
      color: blue;
      font-size: 20px;
    }
    (a) orange (b) green (c) blue
  8. 8.🧩 Which language makes a link? (a) JavaScript (b) CSS (c) HTML
  9. 9.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 18px;
      }
    }
  10. 10.🌈 Which hex code is white? (a) #00ff00 (b) #ffff00 (c) #000000 (d) #ffffff
  11. 11.🌈 In #0000f2 the blue part is the hex number f2. What is it as a normal number?
  12. 12.🎯 Which CSS selector matches this element?
    <p class="box" id="end">Hello</p>
    (a) .star (b) #box (c) .box (d) h1
  13. 13.Which of these does JavaScript do? (a) puts a picture on a page (b) adds space around boxes (c) gives the page structure (d) reacts to a button click
  14. 14.🎯 Which sign starts a class selector? (a) & (b) @ (c) . (d) #
  15. 15.⚖️ Which selector is the weakest? (a) a class selector (b) an id selector (c) an element selector
  16. 16.🎯 Which CSS selector matches this element?
    <span class="box" id="end">Hello</span>
    (a) .box (b) p (c) #box (d) #hero
  17. 17.✍️ What value is given to color in this rule?
    .note {
      border: 2px solid;
      margin: 10px;
      color: red;
    }
    (a) color (b) red (c) 20px (d) center
  18. 18.📱 min-width: 800px applies when the screen is ___. (a) turned off (b) exactly 100px (c) 800px or wider (d) 800px or narrower
  19. 19.True or false: #top is an id selector. (a) True (b) False
  20. 20.🎯 What kind of selector is .card? (a) a class selector (b) an element selector (c) an id selector
  21. 21.📦 In the box model, which part is space inside the border? (a) margin (b) padding (c) border (d) content
  22. 22.🌈 Hex digits go 0 to 9, then A to which letter? (a) Z (b) F (c) G (d) J
  23. 23.🎯 What kind of selector is h1? (a) an id selector (b) an element selector (c) a class selector
  24. 24.Which of these does HTML do? (a) adds space around boxes (b) gives the page structure (c) reacts to a button click (d) lays out the page
  25. 25.📱 Which tag helps phones show a page at the right size? (a) the br tag (b) the viewport meta tag (c) the hr tag (d) the title tag
  26. 26.📱 The screen is 540px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 20px;
      }
    }
    (a) No (b) Yes
  27. 27.🌈 Which colour of light is strongest in rgb(95, 7, 155)? (a) blue (b) green (c) red
  28. 28.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 200px;
      padding: 30px;
      border: 4px solid black;
      margin: 15px;
    }
  29. 29.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 18px;
      }
    }
    (a) Yes (b) No
  30. 30.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 200px;
      padding: 20px;
      border: 3px solid black;
      margin: 15px;
    }
  31. 31.🎨 One CSS file can style how many pages? (a) only one image (b) no pages (c) many pages (d) only one word
  32. 32.🖌️ What colour is behind the letters?
    h1 {
      color: red;
      background-color: purple;
      text-align: center;
      font-size: 40px;
    }
    (a) purple (b) red (c) orange
  33. 33.🖌️ How big is the text, in px?
    li {
      background-color: yellow;
      color: black;
      text-align: left;
      font-size: 40px;
    }
  34. 34.🎯 How many elements on a page should have the same id? (a) any number (b) 1 (c) 5 (d) 2
  35. 35.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 180px;
      justify-content: center;
    }
    Inside are 2 boxes, each 50px wide (no margins).
  36. 36.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 14px;
      }
    }
    (a) Yes (b) No
  37. 37.⚖️ What colour is the text of this element?
    <p class="note" id="logo">Hi</p>
    CSS:
    .note { color: orange; }
    .note { color: green; }
    (a) red (b) white (c) green (d) orange
  38. 38.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 270px;
      justify-content: center;
    }
    Inside are 3 boxes, each 50px wide (no margins).
  39. 39.💪 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 40px wide (no margins).
  40. 40.✍️ How many declarations (property: value pairs) are in this rule?
    .box {
      padding: 8px;
      color: red;
      border: 2px solid;
    }

Answer key

  1. the later one
  2. #ff00ff
  3. font-style
  4. { }
  5. orange
  6. False
  7. orange
  8. HTML
  9. 18
  10. #ffffff
  11. 242
  12. .box
  13. reacts to a button click
  14. .
  15. an element selector
  16. .box
  17. red
  18. 800px or wider
  19. True
  20. a class selector
  21. padding
  22. F
  23. an element selector
  24. gives the page structure
  25. the viewport meta tag
  26. No
  27. blue
  28. 298
  29. No
  30. 246
  31. many pages
  32. purple
  33. 40
  34. 1
  35. 40
  36. No
  37. green
  38. 60
  39. 80
  40. 3

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