← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 288 · 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 justify-content value equal gaps, none at ends? (a) flex-end (b) center (c) space-between (d) flex-start
  2. 2.⚖️ Which selector is the weakest? (a) an element selector (b) an id selector (c) a class selector
  3. 3.Which of these does JavaScript do? (a) makes a link (b) makes a form box (c) makes headings and lists (d) changes the page live
  4. 4.🌈 Which colour of light is strongest in rgb(82, 182, 49)? (a) blue (b) red (c) green
  5. 5.🎯 Can many elements share the same class? (a) Yes (b) No
  6. 6.🎨 One CSS file can style how many pages? (a) only one image (b) no pages (c) many pages (d) only one word
  7. 7.What does font-weight do? (a) makes letters bigger (b) makes the text bold (c) colours behind the text (d) sets the letter colour
  8. 8.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
  9. 9.💪 Which justify-content value packs boxes at the start? (a) space-between (b) flex-end (c) flex-start (d) center
  10. 10.✍️ What is the selector in this CSS rule?
    p {
      font-style: italic;
      width: 300px;
      font-weight: bold;
    }
    (a) .note (b) 300px (c) p (d) font-style
  11. 11.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 190px;
      justify-content: flex-end;
    }
    Inside are 2 boxes, each 60px wide (no margins).
  12. 12.✍️ Which property is set to 300px in this rule?
    .note {
      color: red;
      width: 300px;
    }
    (a) 300px (b) color (c) width (d) font-style
  13. 13.Which of these does HTML do? (a) rounds box corners (b) counts down a timer (c) lays out the page (d) makes headings and lists
  14. 14.✍️ What value is given to color in this rule?
    .box {
      border: 2px solid;
      color: red;
      text-align: center;
      margin: 10px;
    }
    (a) 20px (b) red (c) center (d) color
  15. 15.📦 In the box model, which part is the line round the box? (a) border (b) margin (c) content (d) padding
  16. 16.📦 In the box model, which part is the gap to other boxes? (a) padding (b) border (c) content (d) margin
  17. 17.🌈 Which colour is #ffff00? (a) yellow (b) red (c) bright green (d) black
  18. 18.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the shorter one (b) the later one (c) neither (d) the first one
  19. 19.⚖️ What colour is the text of this element?
    <h2 class="box" id="top">Hi</h2>
    CSS:
    h2 { color: blue; }
    h2 { color: green; }
    (a) green (b) blue (c) red (d) yellow
  20. 20.⚖️ What colour is the text of this element?
    <h2 class="star" id="end">Hi</h2>
    CSS:
    .star { color: yellow; }
    .star { color: blue; }
    (a) purple (b) blue (c) green (d) yellow
  21. 21.✍️ What value is given to width in this rule?
    h1 {
      color: red;
      background-color: yellow;
      width: 300px;
      border: 2px solid;
    }
    (a) italic (b) 300px (c) red (d) width
  22. 22.🎯 Which CSS selector matches this element?
    <h2 class="menu" id="intro">Hello</h2>
    (a) .menu (b) li (c) #main (d) #menu
  23. 23.🌈 In #000000 the red part is the hex number 00. What is it as a normal number?
  24. 24.✍️ How many declarations (property: value pairs) are in this rule?
    p {
      color: red;
    }
  25. 25.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 160px;
      justify-content: center;
    }
    Inside are 2 boxes, each 40px wide (no margins).
  26. 26.⚖️ What colour is the text of this element?
    <h2 class="red" id="top">Hi</h2>
    CSS:
    h2 { color: green; }
    h2 { color: orange; }
    (a) purple (b) orange (c) red (d) green
  27. 27.🎯 What kind of selector is #logo? (a) an element selector (b) a class selector (c) an id selector
  28. 28.💪 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).
  29. 29.🌈 Which colour of light is strongest in rgb(199, 84, 139)? (a) red (b) blue (c) green
  30. 30.📱 min-width: 800px applies when the screen is ___. (a) 800px or wider (b) turned off (c) 800px or narrower (d) exactly 100px
  31. 31.What does text-align do? (a) picks the font style (b) colours behind the text (c) sets the letter colour (d) centres a heading
  32. 32.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 24px;
      }
    }
  33. 33.🌈 In #00e100 the green part is the hex number e1. What is it as a normal number?
  34. 34.📱 The screen is 1100px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 24px;
      }
    }
    (a) No (b) Yes
  35. 35.🌈 Which colour of light is strongest in rgb(0, 211, 68)? (a) blue (b) green (c) red
  36. 36.🎯 Which element does the selector div style? (a) <p class="big"> (b) <div class="big"> (c) <span> (d) <h1 id="intro">
  37. 37.🌈 Which hex code is white? (a) #0000ff (b) #000000 (c) #ffffff (d) #ffff00
  38. 38.✍️ In color: blue; which part is the value? (a) : (b) color (c) ; (d) blue
  39. 39.🖌️ What colour are the letters?
    h1 {
      color: black;
      font-size: 20px;
      background-color: purple;
      text-align: center;
    }
    (a) purple (b) white (c) black
  40. 40.📱 The screen is 414px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 18px;
      }
    }
    (a) No (b) Yes

Answer key

  1. space-between
  2. an element selector
  3. changes the page live
  4. green
  5. Yes
  6. many pages
  7. makes the text bold
  8. packs boxes at the end
  9. flex-start
  10. p
  11. 70
  12. width
  13. makes headings and lists
  14. red
  15. border
  16. margin
  17. yellow
  18. the later one
  19. green
  20. blue
  21. 300px
  22. .menu
  23. 0
  24. 1
  25. 40
  26. orange
  27. an id selector
  28. 10
  29. red
  30. 800px or wider
  31. centres a heading
  32. 24
  33. 225
  34. Yes
  35. green
  36. <div class="big">
  37. #ffffff
  38. blue
  39. black
  40. No

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