← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 234 · 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.🎨 Which tag connects an outside CSS file? (a) <link> (b) <css> (c) <a> (d) <img>
  2. 2.⚖️ Which selector is the strongest? (a) a class selector (b) an id selector (c) an element selector
  3. 3.What does background-color do? (a) makes the text bold (b) centres a heading (c) picks the font style (d) colours behind the text
  4. 4.🌈 Which colour is rgb(0, 255, 255)? (a) blue (b) cyan (c) white (d) black
  5. 5.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 260px;
      justify-content: center;
    }
    Inside are 3 boxes, each 80px wide (no margins).
  6. 6.🎨 Which tag holds CSS inside the head? (a) <script> (b) <body> (c) <css> (d) <style>
  7. 7.🎯 What kind of selector is #top? (a) an element selector (b) a class selector (c) an id selector
  8. 8.📱 The screen is 700px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 30px;
      }
    }
    (a) Yes (b) No
  9. 9.🌈 Which colour is rgb(255, 255, 255)? (a) black (b) white (c) red (d) blue
  10. 10.🔍 Which is the odd one out? (a) shows a pop-up message (b) changes the page live (c) counts down a timer (d) makes a link
  11. 11.🎯 What kind of selector is #hero? (a) a class selector (b) an element selector (c) an id selector
  12. 12.What does justify-content: flex-end do? (a) packs boxes at the end (b) puts boxes in the middle (c) packs boxes at the start (d) equal gaps, none at ends
  13. 13.📦 In the box model, which part is the text or picture? (a) border (b) margin (c) padding (d) content
  14. 14.⚖️ What colour is the text of this element?
    <h1 class="big" id="main">Hi</h1>
    CSS:
    .big { color: white; }
    .big { color: blue; }
    (a) purple (b) white (c) yellow (d) blue
  15. 15.📱 What does a media query check? (a) the time of day (b) the screen width (c) the page title (d) the battery level
  16. 16.What does font-weight do? (a) makes the text bold (b) sets the letter colour (c) colours behind the text (d) centres a heading
  17. 17.🌈 Which colour is rgb(0, 0, 0)? (a) bright green (b) black (c) yellow (d) magenta
  18. 18.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 240px;
      justify-content: flex-start;
    }
    Inside are 3 boxes, each 60px wide (no margins).
  19. 19.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 50px;
      padding: 5px;
      border: 2px solid black;
      margin: 5px;
    }
  20. 20.🎯 Can many elements share the same class? (a) No (b) Yes
  21. 21.⚖️ What colour is the text of this element?
    <h1 class="box" id="main">Hi</h1>
    CSS:
    .box { color: blue; }
    #main { color: orange; }
    h1 { color: black; }
    (a) black (b) yellow (c) blue (d) orange
  22. 22.True or false: HTML makes headings and lists. (a) True (b) False
  23. 23.🌈 In #rrggbb, which colour do the first two digits give? (a) black (b) blue (c) green (d) red
  24. 24.🌈 Which colour of light is strongest in rgb(239, 42, 19)? (a) green (b) red (c) blue
  25. 25.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 180px;
      padding: 5px;
      border: 4px solid black;
      margin: 15px;
    }
  26. 26.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 450px;
      justify-content: space-between;
    }
    Inside are 4 boxes, each 60px wide (no margins).
  27. 27.💪 Which justify-content value puts boxes in the middle? (a) space-between (b) flex-start (c) flex-end (d) center
  28. 28.⚖️ What colour is the text of this element?
    <p class="star" id="end">Hi</p>
    CSS:
    #end { color: yellow; }
    #end { color: orange; }
    (a) white (b) orange (c) yellow (d) blue
  29. 29.🎯 What kind of selector is #logo? (a) an id selector (b) an element selector (c) a class selector
  30. 30.✍️ Which sign goes between a property and its value? (a) - (b) : (c) ; (d) =
  31. 31.True or false: JavaScript shows a pop-up message. (a) True (b) False
  32. 32.🎯 Which sign starts an id selector? (a) . (b) & (c) # (d) @
  33. 33.⚖️ Which selector is the weakest? (a) a class selector (b) an element selector (c) an id selector
  34. 34.⚖️ What colour is the text of this element?
    <h2 class="red" id="hero">Hi</h2>
    CSS:
    h2 { color: green; }
    h2 { color: white; }
    (a) white (b) black (c) green (d) purple
  35. 35.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 270px;
      padding: 25px;
      border: 1px solid black;
      margin: 20px;
    }
  36. 36.✍️ How many declarations (property: value pairs) are in this rule?
    .note {
      font-size: 20px;
      color: red;
      padding: 8px;
    }
  37. 37.🖌️ Which CSS property sets the letter colour? (a) background-color (b) font-weight (c) color (d) text-align
  38. 38.✍️ How many declarations (property: value pairs) are in this rule?
    h1 {
      font-style: italic;
    }
  39. 39.🖌️ Which CSS property picks the font style? (a) color (b) font-family (c) background-color (d) text-align
  40. 40.🌈 Which hex code is yellow? (a) #ffffff (b) #ff00ff (c) #ffff00 (d) #ff0000

Answer key

  1. <link>
  2. an id selector
  3. colours behind the text
  4. cyan
  5. 10
  6. <style>
  7. an id selector
  8. Yes
  9. white
  10. makes a link
  11. an id selector
  12. packs boxes at the end
  13. content
  14. blue
  15. the screen width
  16. makes the text bold
  17. black
  18. 60
  19. 64
  20. Yes
  21. orange
  22. True
  23. red
  24. red
  25. 228
  26. 70
  27. center
  28. orange
  29. an id selector
  30. :
  31. True
  32. #
  33. an element selector
  34. white
  35. 362
  36. 3
  37. color
  38. 1
  39. font-family
  40. #ffff00

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