← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 89 · 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) picks the font style (b) centres a heading (c) makes the text bold (d) makes letters bigger
  2. 2.What does text-align do? (a) makes letters bigger (b) colours behind the text (c) centres a heading (d) sets the letter colour
  3. 3.Which of these does HTML do? (a) changes the text size (b) sets colours and fonts (c) lays out the page (d) makes a link
  4. 4.✍️ What is the selector in this CSS rule?
    #top {
      color: red;
      font-weight: bold;
      margin: 10px;
      font-size: 20px;
    }
    (a) color (b) bold (c) #top (d) li
  5. 5.✍️ What value is given to width in this rule?
    h1 {
      width: 300px;
      text-align: center;
    }
    (a) 300px (b) red (c) italic (d) width
  6. 6.🌈 Which hex code is yellow? (a) #ffff00 (b) #000000 (c) #ff0000 (d) #00ffff
  7. 7.📦 In the box model, which part is space inside the border? (a) margin (b) content (c) padding (d) border
  8. 8.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 250px;
      padding: 5px;
      border: 4px solid black;
      margin: 10px;
    }
  9. 9.🎯 Which element does the selector p style? (a) <h2 class="menu"> (b) <li id="intro"> (c) <p class="menu"> (d) <h1>
  10. 10.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 14px;
      }
    }
  11. 11.True or false: JavaScript makes a form box. (a) False (b) True
  12. 12.✍️ CSS declarations go inside which brackets? (a) < > (b) { } (c) [ ] (d) ( )
  13. 13.🌈 In #380000 the red part is the hex number 38. What is it as a normal number?
  14. 14.✍️ How many declarations (property: value pairs) are in this rule?
    #top {
      color: red;
      background-color: yellow;
    }
  15. 15.💪 Which flexbox property spaces boxes along a row? (a) align-items (b) flex-direction (c) justify-content (d) gap
  16. 16.⚖️ What colour is the text of this element?
    <p class="red" id="logo">Hi</p>
    CSS:
    p { color: green; }
    p { color: red; }
    (a) red (b) white (c) yellow (d) green
  17. 17.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 50px;
      padding: 5px;
      border: 1px solid black;
      margin: 0px;
    }
  18. 18.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 60px;
      padding: 25px;
      border: 4px solid black;
      margin: 5px;
    }
  19. 19.✍️ Which property is set to 10px in this rule?
    .note {
      margin: 10px;
      text-align: center;
      color: red;
      padding: 8px;
    }
    (a) font-weight (b) 10px (c) padding (d) margin
  20. 20.Which of these is padding? (a) the gap round content (b) a solid or dotted edge (c) the line round the box (d) space outside the border
  21. 21.🌈 Which colour is rgb(255, 255, 255)? (a) yellow (b) blue (c) white (d) black
  22. 22.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 18px;
      }
    }
  23. 23.🎯 Which element does the selector p style? (a) <h1> (b) <li id="hero"> (c) <h2 class="note"> (d) <p class="note">
  24. 24.True or false: .note is an element selector. (a) False (b) True
  25. 25.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 100px;
      justify-content: center;
    }
    Inside are 2 boxes, each 40px wide (no margins).
  26. 26.🎨 Which tag holds CSS inside the head? (a) <script> (b) <css> (c) <body> (d) <style>
  27. 27.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 8px;
      }
    }
  28. 28.True or false: #logo is a class selector. (a) False (b) True
  29. 29.🌈 Which colour is #ff0000? (a) blue (b) magenta (c) red (d) white
  30. 30.🌈 Which hex code is black? (a) #0000ff (b) #ff00ff (c) #000000 (d) #00ffff
  31. 31.True or false: the border is the line round the box. (a) False (b) True
  32. 32.🌈 In #rrggbb, which colour do the first two digits give? (a) green (b) red (c) blue (d) black
  33. 33.🌈 Which colour is rgb(255, 255, 0)? (a) red (b) yellow (c) white (d) magenta
  34. 34.🔍 Which is the odd one out? (a) makes headings and lists (b) gives the page structure (c) makes a link (d) lays out the page
  35. 35.✍️ Which property is set to 300px in this rule?
    .box {
      font-weight: bold;
      width: 300px;
    }
    (a) 300px (b) width (c) font-style (d) color
  36. 36.⚖️ What colour is the text of this element?
    <h1 class="menu" id="end">Hi</h1>
    CSS:
    #end { color: red; }
    h1 { color: black; }
    .menu { color: yellow; }
    (a) red (b) blue (c) black (d) yellow
  37. 37.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 210px;
      justify-content: flex-end;
    }
    Inside are 2 boxes, each 80px wide (no margins).
  38. 38.🧩 Which language gives the page structure? (a) JavaScript (b) CSS (c) HTML
  39. 39.📱 min-width: 800px applies when the screen is ___. (a) 800px or narrower (b) exactly 100px (c) 800px or wider (d) turned off
  40. 40.✍️ How many declarations (property: value pairs) are in this rule?
    .box {
      width: 300px;
      padding: 8px;
      border: 2px solid;
    }

Answer key

  1. picks the font style
  2. centres a heading
  3. makes a link
  4. #top
  5. 300px
  6. #ffff00
  7. padding
  8. 268
  9. <p class="menu">
  10. 20
  11. False
  12. { }
  13. 56
  14. 2
  15. justify-content
  16. red
  17. 62
  18. 128
  19. margin
  20. the gap round content
  21. white
  22. 18
  23. <p class="note">
  24. False
  25. 10
  26. <style>
  27. 12
  28. False
  29. red
  30. #000000
  31. True
  32. red
  33. yellow
  34. lays out the page
  35. width
  36. red
  37. 50
  38. HTML
  39. 800px or wider
  40. 3

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