← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 212 · 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.True or false: CSS lays out the page. (a) True (b) False
  2. 2.💪 Which flexbox property spaces boxes along a row? (a) flex-direction (b) justify-content (c) align-items (d) display: flex
  3. 3.True or false: JavaScript makes headings and lists. (a) True (b) False
  4. 4.🎯 What kind of selector is #main? (a) an id selector (b) a class selector (c) an element selector
  5. 5.🖌️ How big is the text, in px?
    h1 {
      font-size: 20px;
      background-color: red;
      text-align: center;
      color: purple;
    }
  6. 6.📱 Which tag helps phones show a page at the right size? (a) the br tag (b) the viewport meta tag (c) the hr tag (d) the title tag
  7. 7.⚖️ What colour is the text of this element?
    <p class="menu" id="hero">Hi</p>
    CSS:
    #hero { color: orange; }
    #hero { color: purple; }
    (a) purple (b) orange (c) white (d) red
  8. 8.🎯 Which sign starts an id selector? (a) @ (b) . (c) & (d) #
  9. 9.🖌️ What colour are the letters?
    h1 {
      color: red;
      background-color: purple;
      text-align: left;
      font-size: 12px;
    }
    (a) purple (b) yellow (c) red
  10. 10.🌈 Which hex code is magenta? (a) #ff00ff (b) #00ffff (c) #ffffff (d) #00ff00
  11. 11.🎯 Which sign starts a class selector? (a) & (b) . (c) @ (d) #
  12. 12.✍️ Which property is set to 2px solid in this rule?
    body {
      background-color: yellow;
      border: 2px solid;
    }
    (a) font-style (b) border (c) 2px solid (d) width
  13. 13.🖌️ How big is the text, in px?
    h1 {
      text-align: left;
      background-color: green;
      color: blue;
      font-size: 20px;
    }
  14. 14.🖌️ Which CSS property makes the text bold? (a) background-color (b) font-family (c) font-weight (d) color
  15. 15.⚖️ Which selector is the strongest? (a) an element selector (b) an id selector (c) a class selector
  16. 16.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 240px;
      justify-content: center;
    }
    Inside are 2 boxes, each 100px wide (no margins).
  17. 17.🔍 Which is the odd one out? (a) changes the text size (b) rounds box corners (c) shows a pop-up message (d) adds space around boxes
  18. 18.What does font-size do? (a) centres a heading (b) makes letters bigger (c) picks the font style (d) colours behind the text
  19. 19.What does justify-content: flex-start do? (a) packs boxes at the end (b) equal gaps, none at ends (c) puts boxes in the middle (d) packs boxes at the start
  20. 20.🖌️ How big is the text, in px?
    h1 {
      color: red;
      background-color: purple;
      text-align: right;
      font-size: 40px;
    }
  21. 21.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 190px;
      padding: 20px;
      border: 1px solid black;
      margin: 10px;
    }
  22. 22.🎯 Which CSS selector matches this element?
    <div class="note" id="intro">Hello</div>
    (a) #main (b) span (c) .intro (d) #intro
  23. 23.🌈 In #00f600 the green part is the hex number f6. What is it as a normal number?
  24. 24.🌈 Which colour of light is strongest in rgb(21, 201, 45)? (a) green (b) blue (c) red
  25. 25.🧩 Which language changes the text size? (a) JavaScript (b) HTML (c) CSS
  26. 26.🧩 Which language sets colours and fonts? (a) JavaScript (b) CSS (c) HTML
  27. 27.✍️ Which property is set to 2px solid in this rule?
    li {
      border: 2px solid;
      color: red;
      margin: 10px;
    }
    (a) border (b) width (c) font-style (d) 2px solid
  28. 28.⚖️ What colour is the text of this element?
    <p class="note" id="main">Hi</p>
    CSS:
    p { color: yellow; }
    .note { color: red; }
    #main { color: purple; }
    (a) yellow (b) purple (c) red (d) white
  29. 29.🖌️ What colour are the letters?
    p {
      color: green;
      font-size: 36px;
      text-align: left;
      background-color: purple;
    }
    (a) green (b) purple (c) black
  30. 30.🎯 Which element does the selector .note style? (a) <p id="note"> (b) <h1 class="red"> (c) <p class="big"> (d) <p class="note">
  31. 31.🎨 What does CSS stand for? (a) Cascading Style Sheets (b) Creative Sheet System (c) Colourful Site Styles (d) Computer Style Sheets
  32. 32.📱 The screen is 700px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 16px;
      }
    }
    (a) Yes (b) No
  33. 33.What does justify-content: flex-end do? (a) puts boxes in the middle (b) packs boxes at the start (c) packs boxes at the end (d) equal gaps, none at ends
  34. 34.✍️ Which property is set to italic in this rule?
    h1 {
      color: red;
      font-style: italic;
    }
    (a) font-style (b) font-size (c) color (d) italic
  35. 35.🌈 Which colour is rgb(255, 255, 255)? (a) red (b) white (c) blue (d) yellow
  36. 36.🎨 One CSS file can style how many pages? (a) many pages (b) only one image (c) no pages (d) only one word
  37. 37.⚖️ What colour is the text of this element?
    <p class="star" id="main">Hi</p>
    CSS:
    .star { color: green; }
    p { color: blue; }
    #main { color: white; }
    (a) green (b) white (c) orange (d) blue
  38. 38.🧩 Which language puts a picture on a page? (a) CSS (b) HTML (c) JavaScript
  39. 39.🌈 Which colour of light is strongest in rgb(199, 139, 6)? (a) blue (b) red (c) green
  40. 40.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 14px;
      }
    }
    (a) No (b) Yes

Answer key

  1. True
  2. justify-content
  3. False
  4. an id selector
  5. 20
  6. the viewport meta tag
  7. purple
  8. #
  9. red
  10. #ff00ff
  11. .
  12. border
  13. 20
  14. font-weight
  15. an id selector
  16. 20
  17. shows a pop-up message
  18. makes letters bigger
  19. packs boxes at the start
  20. 40
  21. 232
  22. #intro
  23. 246
  24. green
  25. CSS
  26. CSS
  27. border
  28. purple
  29. green
  30. <p class="note">
  31. Cascading Style Sheets
  32. No
  33. packs boxes at the end
  34. font-style
  35. white
  36. many pages
  37. white
  38. HTML
  39. red
  40. Yes

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