← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 617 · 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 are the letters?
    h2 {
      background-color: green;
      color: black;
      font-size: 40px;
      text-align: right;
    }
    (a) black (b) orange (c) green
  2. 2.📱 Which tag helps phones show a page at the right size? (a) the hr tag (b) the title tag (c) the br tag (d) the viewport meta tag
  3. 3.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the first one (b) the shorter one (c) neither (d) the later one
  4. 4.🌈 In #ae0000 the red part is the hex number ae. What is it as a normal number?
  5. 5.🌈 Which colour of light is strongest in rgb(32, 221, 59)? (a) red (b) green (c) blue
  6. 6.⚖️ What colour is the text of this element?
    <h1 class="star" id="end">Hi</h1>
    CSS:
    h1 { color: red; }
    h1 { color: purple; }
    (a) green (b) purple (c) red (d) white
  7. 7.⚖️ What colour is the text of this element?
    <h2 class="big" id="top">Hi</h2>
    CSS:
    .big { color: green; }
    .big { color: red; }
    (a) red (b) yellow (c) black (d) green
  8. 8.🖌️ Which CSS property makes the text bold? (a) background-color (b) font-weight (c) text-align (d) font-size
  9. 9.⚖️ What colour is the text of this element?
    <h1 class="big" id="intro">Hi</h1>
    CSS:
    .big { color: green; }
    .big { color: orange; }
    (a) orange (b) green (c) black (d) blue
  10. 10.🖌️ Which CSS property colours behind the text? (a) font-family (b) background-color (c) font-size (d) text-align
  11. 11.🎯 Which element does the selector #end style? (a) <li class="end"> (b) <li id="end"> (c) <div class="note"> (d) <li id="hero">
  12. 12.⚖️ Which selector is the weakest? (a) an element selector (b) a class selector (c) an id selector
  13. 13.🎯 Which element does the selector h2 style? (a) <h2 class="menu"> (b) <div class="menu"> (c) <span id="intro"> (d) <li>
  14. 14.📱 What does a media query check? (a) the battery level (b) the screen width (c) the time of day (d) the page title
  15. 15.🎯 Which sign starts a class selector? (a) # (b) . (c) & (d) @
  16. 16.Which of these is padding? (a) space inside the border (b) the text or picture (c) the line round the box (d) space outside the border
  17. 17.📱 max-width: 600px applies when the screen is ___. (a) exactly 1000px (b) turned off (c) 600px or wider (d) 600px or narrower
  18. 18.💪 Which justify-content value puts boxes in the middle? (a) flex-start (b) space-between (c) center (d) flex-end
  19. 19.✍️ How many declarations (property: value pairs) are in this rule?
    h1 {
      margin: 10px;
      font-style: italic;
      background-color: yellow;
      width: 300px;
    }
  20. 20.What does justify-content: center do? (a) puts boxes in the middle (b) packs boxes at the start (c) equal gaps, none at ends (d) packs boxes at the end
  21. 21.🌈 Which colour is rgb(0, 255, 0)? (a) cyan (b) white (c) red (d) bright green
  22. 22.🎯 Which CSS selector matches this element?
    <p class="note" id="top">Hello</p>
    (a) .top (b) #note (c) .big (d) .note
  23. 23.✍️ In color: blue; which part is the value? (a) color (b) : (c) blue (d) ;
  24. 24.True or false: #hero is a class selector. (a) False (b) True
  25. 25.🎨 What does CSS stand for? (a) Computer Style Sheets (b) Colourful Site Styles (c) Creative Sheet System (d) Cascading Style Sheets
  26. 26.🖌️ Where does the text sit on its line?
    h1 {
      color: orange;
      background-color: yellow;
      font-size: 12px;
      text-align: center;
    }
    (a) on the left (b) in the middle (c) on the right
  27. 27.✍️ What value is given to color in this rule?
    h1 {
      color: red;
      font-weight: bold;
      margin: 10px;
      padding: 8px;
    }
    (a) 20px (b) center (c) red (d) color
  28. 28.🖌️ Which CSS property centres a heading? (a) text-align (b) font-weight (c) font-family (d) background-color
  29. 29.Which of these does JavaScript do? (a) changes the text size (b) makes a form box (c) shows a pop-up message (d) makes a link
  30. 30.🌈 Which colour of light is strongest in rgb(113, 69, 225)? (a) green (b) blue (c) red
  31. 31.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 400px;
      justify-content: flex-start;
    }
    Inside are 4 boxes, each 80px wide (no margins).
  32. 32.🖌️ What colour is behind the letters?
    h1 {
      font-size: 24px;
      background-color: green;
      color: orange;
      text-align: right;
    }
    (a) orange (b) green (c) purple
  33. 33.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 300px;
      justify-content: center;
    }
    Inside are 4 boxes, each 60px wide (no margins).
  34. 34.🎯 Which element does the selector p style? (a) <li id="intro"> (b) <h1> (c) <h2 class="box"> (d) <p class="box">
  35. 35.✍️ Which property is set to 8px in this rule?
    #top {
      margin: 10px;
      padding: 8px;
    }
    (a) 8px (b) font-weight (c) border (d) padding
  36. 36.⚖️ What colour is the text of this element?
    <h1 class="menu" id="hero">Hi</h1>
    CSS:
    .menu { color: green; }
    h1 { color: blue; }
    #hero { color: red; }
    (a) blue (b) green (c) red (d) white
  37. 37.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 200px;
      padding: 15px;
      border: 2px solid black;
      margin: 10px;
    }
  38. 38.✍️ What is the selector in this CSS rule?
    h2 {
      width: 300px;
      margin: 10px;
      background-color: yellow;
      color: red;
    }
    (a) width (b) h2 (c) h1 (d) 10px
  39. 39.⚖️ What colour is the text of this element?
    <h1 class="red" id="logo">Hi</h1>
    CSS:
    .red { color: purple; }
    h1 { color: red; }
    #logo { color: blue; }
    (a) blue (b) red (c) purple (d) orange
  40. 40.Which of these does CSS do? (a) checks a quiz answer (b) sets colours and fonts (c) puts a picture on a page (d) changes the page live

Answer key

  1. black
  2. the viewport meta tag
  3. the later one
  4. 174
  5. green
  6. purple
  7. red
  8. font-weight
  9. orange
  10. background-color
  11. <li id="end">
  12. an element selector
  13. <h2 class="menu">
  14. the screen width
  15. .
  16. space inside the border
  17. 600px or narrower
  18. center
  19. 4
  20. puts boxes in the middle
  21. bright green
  22. .note
  23. blue
  24. False
  25. Cascading Style Sheets
  26. in the middle
  27. red
  28. text-align
  29. shows a pop-up message
  30. blue
  31. 80
  32. green
  33. 30
  34. <p class="box">
  35. padding
  36. red
  37. 234
  38. h2
  39. blue
  40. sets colours and fonts

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