← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 161 · 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 colour is the text of this element?
    <h2 class="box" id="logo">Hi</h2>
    CSS:
    .box { color: purple; }
    .box { color: orange; }
    (a) black (b) orange (c) yellow (d) purple
  2. 2.⚖️ Which selector is the weakest? (a) a class selector (b) an element selector (c) an id selector
  3. 3.🧩 Which language makes a form box? (a) CSS (b) HTML (c) JavaScript
  4. 4.⚖️ Which selector is the strongest? (a) an id selector (b) an element selector (c) a class selector
  5. 5.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 160px;
      justify-content: flex-start;
    }
    Inside are 3 boxes, each 40px wide (no margins).
  6. 6.⚖️ What colour is the text of this element?
    <h1 class="red" id="main">Hi</h1>
    CSS:
    .red { color: blue; }
    .red { color: green; }
    (a) black (b) orange (c) blue (d) green
  7. 7.🎨 Which tag connects an outside CSS file? (a) <img> (b) <link> (c) <a> (d) <css>
  8. 8.🧩 Which language lays out the page? (a) JavaScript (b) CSS (c) HTML
  9. 9.✍️ Which sign goes between a property and its value? (a) = (b) : (c) - (d) ;
  10. 10.📱 What does a media query check? (a) the battery level (b) the time of day (c) the screen width (d) the page title
  11. 11.✍️ What value is given to width in this rule?
    p {
      color: red;
      width: 300px;
    }
    (a) italic (b) red (c) width (d) 300px
  12. 12.✍️ How does a CSS comment start? (a) // (b) /* (c) # (d) <!--
  13. 13.✍️ How many declarations (property: value pairs) are in this rule?
    li {
      border: 2px solid;
    }
  14. 14.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 190px;
      justify-content: space-between;
    }
    Inside are 2 boxes, each 80px wide (no margins).
  15. 15.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 180px;
      padding: 10px;
      border: 1px solid black;
      margin: 5px;
    }
  16. 16.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 200px;
      justify-content: flex-end;
    }
    Inside are 2 boxes, each 80px wide (no margins).
  17. 17.🎯 Which element does the selector li style? (a) <p id="main"> (b) <span class="note"> (c) <li class="note"> (d) <div>
  18. 18.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 28px;
      }
    }
  19. 19.💪 Which flexbox property picks row or column? (a) align-items (b) flex-direction (c) gap (d) display: flex
  20. 20.🖌️ What colour is behind the letters?
    h2 {
      text-align: right;
      background-color: green;
      font-size: 20px;
      color: yellow;
    }
    (a) white (b) green (c) yellow
  21. 21.🎯 Which CSS selector matches this element?
    <span class="big" id="logo">Hello</span>
    (a) .red (b) #end (c) #logo (d) .logo
  22. 22.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 160px;
      justify-content: flex-end;
    }
    Inside are 2 boxes, each 50px wide (no margins).
  23. 23.📱 The screen is 700px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 10px;
      }
    }
    (a) Yes (b) No
  24. 24.🌈 Which colour of light is strongest in rgb(154, 93, 51)? (a) green (b) red (c) blue
  25. 25.🔍 Which is the odd one out? (a) makes a link (b) sets colours and fonts (c) puts a picture on a page (d) makes headings and lists
  26. 26.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 8px;
      }
    }
  27. 27.🌈 Which colour of light is strongest in rgb(90, 130, 253)? (a) red (b) green (c) blue
  28. 28.What does font-size do? (a) makes letters bigger (b) makes the text bold (c) picks the font style (d) centres a heading
  29. 29.What does font-family do? (a) sets the letter colour (b) centres a heading (c) makes letters bigger (d) picks the font style
  30. 30.📦 In the box model, which part is space outside the border? (a) border (b) content (c) margin (d) padding
  31. 31.🌈 In #0000a5 the blue part is the hex number a5. What is it as a normal number?
  32. 32.⚖️ What colour is the text of this element?
    <h1 class="note" id="intro">Hi</h1>
    CSS:
    .note { color: blue; }
    h1 { color: orange; }
    #intro { color: yellow; }
    (a) blue (b) orange (c) yellow (d) purple
  33. 33.🎯 Which element does the selector #main style? (a) <li id="logo"> (b) <div class="red"> (c) <li class="main"> (d) <li id="main">
  34. 34.💪 Which justify-content value equal gaps, none at ends? (a) center (b) flex-start (c) space-between (d) flex-end
  35. 35.🎯 What kind of selector is .big? (a) an id selector (b) a class selector (c) an element selector
  36. 36.🎯 Which CSS selector matches this element?
    <h2 class="big" id="main">Hello</h2>
    (a) .main (b) li (c) h2 (d) #logo
  37. 37.⚖️ What colour is the text of this element?
    <p class="big" id="end">Hi</p>
    CSS:
    .big { color: white; }
    .big { color: yellow; }
    (a) white (b) yellow (c) red (d) black
  38. 38.💪 Which justify-content value packs boxes at the end? (a) flex-end (b) space-between (c) flex-start (d) center
  39. 39.⚖️ What colour is the text of this element?
    <p class="note" id="end">Hi</p>
    CSS:
    p { color: purple; }
    #end { color: orange; }
    (a) red (b) orange (c) purple (d) green
  40. 40.True or false: margin is the gap to other boxes. (a) False (b) True

Answer key

  1. orange
  2. an element selector
  3. HTML
  4. an id selector
  5. 40
  6. green
  7. <link>
  8. CSS
  9. :
  10. the screen width
  11. 300px
  12. /*
  13. 1
  14. 30
  15. 212
  16. 40
  17. <li class="note">
  18. 20
  19. flex-direction
  20. green
  21. #logo
  22. 60
  23. No
  24. red
  25. sets colours and fonts
  26. 12
  27. blue
  28. makes letters bigger
  29. picks the font style
  30. margin
  31. 165
  32. yellow
  33. <li id="main">
  34. space-between
  35. a class selector
  36. h2
  37. yellow
  38. flex-end
  39. orange
  40. True

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