← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 936 · 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 kind of selector is .menu? (a) an id selector (b) an element selector (c) a class selector
  2. 2.Which of these is margin? (a) space inside the border (b) a solid or dotted edge (c) the gap to other boxes (d) the gap round content
  3. 3.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 140px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 60px wide (no margins).
  4. 4.What does font-family do? (a) picks the font style (b) makes letters bigger (c) colours behind the text (d) centres a heading
  5. 5.⚖️ What colour is the text of this element?
    <p class="note" id="top">Hi</p>
    CSS:
    #top { color: black; }
    #top { color: red; }
    (a) blue (b) red (c) black (d) yellow
  6. 6.What does font-weight do? (a) centres a heading (b) makes letters bigger (c) colours behind the text (d) makes the text bold
  7. 7.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 180px;
      justify-content: flex-end;
    }
    Inside are 2 boxes, each 60px wide (no margins).
  8. 8.True or false: margin is the gap to other boxes. (a) False (b) True
  9. 9.🧩 Which language makes headings and lists? (a) JavaScript (b) CSS (c) HTML
  10. 10.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 18px;
      }
    }
  11. 11.🎯 How many elements on a page should have the same id? (a) 2 (b) 5 (c) any number (d) 1
  12. 12.True or false: padding is the gap round content. (a) False (b) True
  13. 13.🌈 Which hex code is black? (a) #000000 (b) #ff0000 (c) #ffffff (d) #0000ff
  14. 14.⚖️ Which selector is the strongest? (a) a class selector (b) an id selector (c) an element selector
  15. 15.📱 Responsive design means a page ___. (a) has no pictures (b) never changes (c) is only for laptops (d) fits every screen
  16. 16.⚖️ Two rules with the same selector set a colour. Which one wins? (a) neither (b) the first one (c) the later one (d) the shorter one
  17. 17.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 18px;
      }
    }
  18. 18.True or false: JavaScript checks a quiz answer. (a) False (b) True
  19. 19.🔍 Which is the odd one out? (a) shows a pop-up message (b) changes the page live (c) sets colours and fonts (d) counts down a timer
  20. 20.🌈 In #0000f3 the blue part is the hex number f3. What is it as a normal number?
  21. 21.🖌️ Which CSS property picks the font style? (a) background-color (b) font-family (c) font-weight (d) text-align
  22. 22.🌈 In #0000dc the blue part is the hex number dc. What is it as a normal number?
  23. 23.⚖️ What colour is the text of this element?
    <h1 class="red" id="intro">Hi</h1>
    CSS:
    #intro { color: black; }
    #intro { color: white; }
    (a) orange (b) red (c) black (d) white
  24. 24.⚖️ What colour is the text of this element?
    <h1 class="note" id="top">Hi</h1>
    CSS:
    #top { color: green; }
    #top { color: purple; }
    (a) red (b) yellow (c) purple (d) green
  25. 25.✍️ Which property is set to 20px in this rule?
    .box {
      font-weight: bold;
      background-color: yellow;
      border: 2px solid;
      font-size: 20px;
    }
    (a) 20px (b) font-size (c) background-color (d) text-align
  26. 26.🎯 Can many elements share the same class? (a) Yes (b) No
  27. 27.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 220px;
      justify-content: center;
    }
    Inside are 2 boxes, each 100px wide (no margins).
  28. 28.⚖️ Which selector is the weakest? (a) an element selector (b) an id selector (c) a class selector
  29. 29.🌈 In #660000 the red part is the hex number 66. What is it as a normal number?
  30. 30.✍️ Which property is set to red in this rule?
    h1 {
      padding: 8px;
      text-align: center;
      color: red;
    }
    (a) text-align (b) font-size (c) red (d) color
  31. 31.📱 min-width: 800px applies when the screen is ___. (a) 800px or narrower (b) exactly 100px (c) 800px or wider (d) turned off
  32. 32.True or false: margin is the text or picture. (a) True (b) False
  33. 33.⚖️ What colour is the text of this element?
    <p class="note" id="top">Hi</p>
    CSS:
    #top { color: black; }
    #top { color: orange; }
    (a) green (b) black (c) white (d) orange
  34. 34.🖌️ How big is the text, in px?
    h1 {
      font-size: 16px;
      text-align: right;
      background-color: orange;
      color: purple;
    }
  35. 35.🧩 Which language puts a picture on a page? (a) CSS (b) HTML (c) JavaScript
  36. 36.⚖️ What colour is the text of this element?
    <h1 class="star" id="top">Hi</h1>
    CSS:
    #top { color: purple; }
    #top { color: orange; }
    (a) blue (b) orange (c) red (d) purple
  37. 37.✍️ How does a CSS comment start? (a) # (b) /* (c) // (d) <!--
  38. 38.🎯 Which element does the selector h2 style? (a) <span id="main"> (b) <h2 class="note"> (c) <div class="note"> (d) <li>
  39. 39.🖌️ Which CSS property sets the letter colour? (a) background-color (b) color (c) font-weight (d) text-align
  40. 40.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 230px;
      padding: 10px;
      border: 1px solid black;
      margin: 20px;
    }

Answer key

  1. a class selector
  2. the gap to other boxes
  3. 20
  4. picks the font style
  5. red
  6. makes the text bold
  7. 60
  8. True
  9. HTML
  10. 16
  11. 1
  12. True
  13. #000000
  14. an id selector
  15. fits every screen
  16. the later one
  17. 20
  18. True
  19. sets colours and fonts
  20. 243
  21. font-family
  22. 220
  23. white
  24. purple
  25. font-size
  26. Yes
  27. 10
  28. an element selector
  29. 102
  30. color
  31. 800px or wider
  32. False
  33. orange
  34. 16
  35. HTML
  36. orange
  37. /*
  38. <h2 class="note">
  39. color
  40. 292

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