← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 365 · 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.✍️ What is the selector in this CSS rule?
    body {
      font-style: italic;
      color: red;
    }
    (a) red (b) .box (c) body (d) font-style
  2. 2.📱 The screen is 540px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 8px;
      }
    }
    (a) Yes (b) No
  3. 3.Which of these is the border? (a) space inside the border (b) the gap round content (c) a solid or dotted edge (d) space outside the border
  4. 4.🎯 Which element does the selector #logo style? (a) <h1 class="big"> (b) <p id="logo"> (c) <p id="end"> (d) <p class="logo">
  5. 5.🎨 Which tag connects an outside CSS file? (a) <css> (b) <img> (c) <link> (d) <a>
  6. 6.Which of these is the content? (a) space inside the border (b) the gap to other boxes (c) space outside the border (d) the text or picture
  7. 7.📱 min-width: 800px applies when the screen is ___. (a) turned off (b) 800px or narrower (c) exactly 100px (d) 800px or wider
  8. 8.🌈 Which colour of light is strongest in rgb(127, 37, 255)? (a) red (b) blue (c) green
  9. 9.🎯 Can many elements share the same class? (a) No (b) Yes
  10. 10.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 4 (b) 3 (c) 2 (d) 6
  11. 11.🎯 What kind of selector is #hero? (a) an id selector (b) an element selector (c) a class selector
  12. 12.🖌️ What colour are the letters?
    h2 {
      font-size: 24px;
      text-align: center;
      color: black;
      background-color: red;
    }
    (a) red (b) blue (c) black
  13. 13.⚖️ What colour is the text of this element?
    <h1 class="star" id="hero">Hi</h1>
    CSS:
    h1 { color: black; }
    h1 { color: red; }
    (a) orange (b) red (c) black (d) blue
  14. 14.✍️ What is the selector in this CSS rule?
    h2 {
      margin: 10px;
      font-weight: bold;
    }
    (a) margin (b) h2 (c) bold (d) h1
  15. 15.Which of these does JavaScript do? (a) makes a link (b) sets colours and fonts (c) makes headings and lists (d) reacts to a button click
  16. 16.🌈 Which hex code is red? (a) #ffff00 (b) #ff00ff (c) #00ffff (d) #ff0000
  17. 17.True or false: body is a class selector. (a) False (b) True
  18. 18.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 330px;
      justify-content: flex-start;
    }
    Inside are 4 boxes, each 80px wide (no margins).
  19. 19.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 160px;
      padding: 15px;
      border: 1px solid black;
      margin: 0px;
    }
  20. 20.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 14px;
      }
    }
  21. 21.🧩 Which language lays out the page? (a) JavaScript (b) CSS (c) HTML
  22. 22.🖌️ What colour are the letters?
    h2 {
      color: yellow;
      text-align: left;
      background-color: blue;
      font-size: 40px;
    }
    (a) purple (b) yellow (c) blue
  23. 23.True or false: CSS makes headings and lists. (a) True (b) False
  24. 24.✍️ How many declarations (property: value pairs) are in this rule?
    li {
      width: 300px;
      font-style: italic;
      text-align: center;
    }
  25. 25.🖌️ What colour is behind the letters?
    h2 {
      text-align: center;
      color: black;
      background-color: purple;
      font-size: 32px;
    }
    (a) orange (b) black (c) purple
  26. 26.📦 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: 25px;
      border: 5px solid black;
      margin: 15px;
    }
  27. 27.💪 Which justify-content value packs boxes at the start? (a) flex-start (b) center (c) space-between (d) flex-end
  28. 28.True or false: the border is a solid or dotted edge. (a) False (b) True
  29. 29.🧩 Which language changes the page live? (a) CSS (b) HTML (c) JavaScript
  30. 30.⚖️ What colour is the text of this element?
    <h2 class="box" id="end">Hi</h2>
    CSS:
    #end { color: white; }
    #end { color: blue; }
    (a) white (b) purple (c) blue (d) red
  31. 31.🎯 Which element does the selector #top style? (a) <h2 class="top"> (b) <h2 id="top"> (c) <li class="note"> (d) <h2 id="intro">
  32. 32.🌈 In #rrggbb, which colour do the first two digits give? (a) green (b) black (c) blue (d) red
  33. 33.🌈 Which colour is #ff00ff? (a) black (b) magenta (c) red (d) blue
  34. 34.✍️ CSS declarations go inside which brackets? (a) [ ] (b) < > (c) ( ) (d) { }
  35. 35.⚖️ Which selector is the strongest? (a) an element selector (b) a class selector (c) an id selector
  36. 36.🖌️ Which CSS property colours behind the text? (a) font-weight (b) font-family (c) text-align (d) background-color
  37. 37.📱 Which tag helps phones show a page at the right size? (a) the hr tag (b) the br tag (c) the viewport meta tag (d) the title tag
  38. 38.🖌️ What colour is behind the letters?
    h1 {
      background-color: blue;
      text-align: center;
      color: orange;
      font-size: 36px;
    }
    (a) orange (b) green (c) blue
  39. 39.True or false: the content is the line round the box. (a) False (b) True
  40. 40.✍️ In color: blue; which part is the value? (a) blue (b) color (c) : (d) ;

Answer key

  1. body
  2. Yes
  3. a solid or dotted edge
  4. <p id="logo">
  5. <link>
  6. the text or picture
  7. 800px or wider
  8. blue
  9. Yes
  10. 3
  11. an id selector
  12. black
  13. red
  14. h2
  15. reacts to a button click
  16. #ff0000
  17. False
  18. 10
  19. 192
  20. 16
  21. CSS
  22. yellow
  23. False
  24. 3
  25. purple
  26. 260
  27. flex-start
  28. True
  29. JavaScript
  30. blue
  31. <h2 id="top">
  32. red
  33. magenta
  34. { }
  35. an id selector
  36. background-color
  37. the viewport meta tag
  38. blue
  39. False
  40. blue

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