← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 331 · 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 does font-family do? (a) makes letters bigger (b) picks the font style (c) makes the text bold (d) colours behind the text
  2. 2.🔍 Which is the odd one out? (a) gives the page structure (b) makes a form box (c) puts a picture on a page (d) sets colours and fonts
  3. 3.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 20px;
      }
    }
  4. 4.🌈 What is the biggest number one colour can have in rgb()? (a) 99 (b) 1000 (c) 255 (d) 100
  5. 5.📦 In the box model, which part is the text or picture? (a) border (b) padding (c) content (d) margin
  6. 6.⚖️ Which selector is the strongest? (a) a class selector (b) an element selector (c) an id selector
  7. 7.✍️ What value is given to border in this rule?
    h2 {
      color: red;
      border: 2px solid;
    }
    (a) 2px solid (b) italic (c) border (d) 300px
  8. 8.🎯 Which CSS selector matches this element?
    <h2 class="red" id="main">Hello</h2>
    (a) li (b) .box (c) #red (d) .red
  9. 9.✍️ CSS declarations go inside which brackets? (a) [ ] (b) < > (c) { } (d) ( )
  10. 10.True or false: the content is the text or picture. (a) True (b) False
  11. 11.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 240px;
      justify-content: center;
    }
    Inside are 2 boxes, each 40px wide (no margins).
  12. 12.🎨 Which tag connects an outside CSS file? (a) <link> (b) <img> (c) <a> (d) <css>
  13. 13.True or false: #hero is an id selector. (a) True (b) False
  14. 14.📱 The screen is 1366px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 18px;
      }
    }
    (a) No (b) Yes
  15. 15.⚖️ What colour is the text of this element?
    <p class="menu" id="end">Hi</p>
    CSS:
    .menu { color: white; }
    p { color: red; }
    (a) black (b) yellow (c) red (d) white
  16. 16.🌈 Which colour is #ff00ff? (a) red (b) white (c) black (d) magenta
  17. 17.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the shorter one (b) the first one (c) the later one (d) neither
  18. 18.📦 In the box model, which part is the line round the box? (a) padding (b) content (c) border (d) margin
  19. 19.✍️ How many declarations (property: value pairs) are in this rule?
    .box {
      color: red;
      font-size: 20px;
      font-weight: bold;
    }
  20. 20.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 170px;
      justify-content: flex-end;
    }
    Inside are 2 boxes, each 60px wide (no margins).
  21. 21.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 60px;
      padding: 10px;
      border: 2px solid black;
      margin: 15px;
    }
  22. 22.🔍 Which is the odd one out? (a) shows a pop-up message (b) reacts to a button click (c) checks a quiz answer (d) makes headings and lists
  23. 23.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 30px;
      }
    }
    (a) No (b) Yes
  24. 24.🎯 Which element does the selector li style? (a) <li class="star"> (b) <p id="top"> (c) <span class="star"> (d) <div>
  25. 25.What does background-color do? (a) makes the text bold (b) sets the letter colour (c) colours behind the text (d) centres a heading
  26. 26.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 380px;
      justify-content: flex-end;
    }
    Inside are 4 boxes, each 80px wide (no margins).
  27. 27.True or false: HTML changes the text size. (a) True (b) False
  28. 28.🎨 Which tag holds CSS inside the head? (a) <css> (b) <script> (c) <style> (d) <body>
  29. 29.🎯 Which CSS selector matches this element?
    <span class="note" id="end">Hello</span>
    (a) #note (b) #hero (c) .end (d) #end
  30. 30.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 16px;
      }
    }
  31. 31.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 140px;
      padding: 30px;
      border: 1px solid black;
      margin: 15px;
    }
  32. 32.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 240px;
      justify-content: flex-end;
    }
    Inside are 4 boxes, each 50px wide (no margins).
  33. 33.Which of these is padding? (a) the line round the box (b) a solid or dotted edge (c) space inside the border (d) the text or picture
  34. 34.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 280px;
      padding: 30px;
      border: 3px solid black;
      margin: 5px;
    }
  35. 35.True or false: HTML makes a link. (a) False (b) True
  36. 36.🖌️ What colour is behind the letters?
    p {
      background-color: purple;
      color: orange;
      text-align: center;
      font-size: 28px;
    }
    (a) white (b) orange (c) purple
  37. 37.🖌️ What colour are the letters?
    h2 {
      background-color: white;
      text-align: left;
      font-size: 12px;
      color: green;
    }
    (a) blue (b) white (c) green
  38. 38.🔍 Which is the odd one out? (a) makes headings and lists (b) makes a link (c) puts a picture on a page (d) shows a pop-up message
  39. 39.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 560px;
      justify-content: space-between;
    }
    Inside are 4 boxes, each 80px wide (no margins).
  40. 40.📱 The screen is 700px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 30px;
      }
    }
    (a) No (b) Yes

Answer key

  1. picks the font style
  2. sets colours and fonts
  3. 24
  4. 255
  5. content
  6. an id selector
  7. 2px solid
  8. .red
  9. { }
  10. True
  11. 80
  12. <link>
  13. True
  14. No
  15. white
  16. magenta
  17. the later one
  18. border
  19. 3
  20. 50
  21. 84
  22. makes headings and lists
  23. No
  24. <li class="star">
  25. colours behind the text
  26. 60
  27. False
  28. <style>
  29. #end
  30. 16
  31. 232
  32. 40
  33. space inside the border
  34. 346
  35. True
  36. purple
  37. green
  38. shows a pop-up message
  39. 80
  40. Yes

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