← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 645 · 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 language changes the page live? (a) CSS (b) HTML (c) JavaScript
  2. 2.🖌️ What colour is behind the letters?
    h1 {
      text-align: center;
      background-color: white;
      font-size: 12px;
      color: orange;
    }
    (a) white (b) red (c) orange
  3. 3.💪 Which flexbox property spaces boxes along a row? (a) display: flex (b) align-items (c) justify-content (d) gap
  4. 4.What does justify-content: center do? (a) packs boxes at the end (b) packs boxes at the start (c) puts boxes in the middle (d) equal gaps, none at ends
  5. 5.🌈 Which colour is #ff00ff? (a) magenta (b) bright green (c) yellow (d) red
  6. 6.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the later one (b) the first one (c) neither (d) the shorter one
  7. 7.⚖️ Which selector is the strongest? (a) an id selector (b) a class selector (c) an element selector
  8. 8.🎨 One CSS file can style how many pages? (a) only one word (b) only one image (c) many pages (d) no pages
  9. 9.What does font-size do? (a) makes letters bigger (b) sets the letter colour (c) colours behind the text (d) picks the font style
  10. 10.🖌️ What colour are the letters?
    h2 {
      text-align: left;
      color: purple;
      font-size: 24px;
      background-color: green;
    }
    (a) green (b) blue (c) purple
  11. 11.📱 max-width: 600px applies when the screen is ___. (a) 600px or narrower (b) turned off (c) 600px or wider (d) exactly 1000px
  12. 12.✍️ What is the selector in this CSS rule?
    p {
      color: red;
      font-style: italic;
    }
    (a) italic (b) color (c) p (d) .note
  13. 13.True or false: HTML gives the page structure. (a) True (b) False
  14. 14.🌈 Hex digits go 0 to 9, then A to which letter? (a) J (b) G (c) Z (d) F
  15. 15.🎯 What kind of selector is img? (a) an id selector (b) a class selector (c) an element selector
  16. 16.🖌️ How big is the text, in px?
    p {
      text-align: right;
      background-color: black;
      color: yellow;
      font-size: 12px;
    }
  17. 17.🎯 Which element does the selector .note style? (a) <li class="red"> (b) <h2 class="big"> (c) <h2 id="note"> (d) <h2 class="note">
  18. 18.📦 In the box model, which part is the gap round content? (a) border (b) content (c) margin (d) padding
  19. 19.⚖️ What colour is the text of this element?
    <h1 class="star" id="intro">Hi</h1>
    CSS:
    .star { color: green; }
    .star { color: red; }
    (a) green (b) yellow (c) blue (d) red
  20. 20.🎯 What kind of selector is #main? (a) a class selector (b) an element selector (c) an id selector
  21. 21.Which of these does JavaScript do? (a) makes a form box (b) lays out the page (c) changes the page live (d) makes a link
  22. 22.📦 In the box model, which part is space outside the border? (a) content (b) margin (c) border (d) padding
  23. 23.🌈 What is the biggest number one colour can have in rgb()? (a) 255 (b) 1000 (c) 99 (d) 100
  24. 24.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 22px;
      }
    }
  25. 25.True or false: HTML shows a pop-up message. (a) False (b) True
  26. 26.✍️ How many declarations (property: value pairs) are in this rule?
    #top {
      padding: 8px;
    }
  27. 27.🖌️ What colour is behind the letters?
    h2 {
      text-align: right;
      background-color: black;
      font-size: 40px;
      color: purple;
    }
    (a) red (b) black (c) purple
  28. 28.🎯 Which CSS selector matches this element?
    <h2 class="menu" id="logo">Hello</h2>
    (a) #menu (b) .menu (c) .logo (d) #end
  29. 29.🌈 Which colour is #ffffff? (a) black (b) blue (c) cyan (d) white
  30. 30.🖌️ What colour are the letters?
    h1 {
      text-align: left;
      color: white;
      font-size: 32px;
      background-color: purple;
    }
    (a) black (b) purple (c) white
  31. 31.What does background-color do? (a) colours behind the text (b) picks the font style (c) centres a heading (d) sets the letter colour
  32. 32.✍️ What value is given to background-color in this rule?
    body {
      background-color: yellow;
      border: 2px solid;
    }
    (a) 10px (b) yellow (c) 8px (d) background-color
  33. 33.✍️ What is the selector in this CSS rule?
    p {
      font-size: 20px;
      font-style: italic;
      background-color: yellow;
    }
    (a) italic (b) p (c) font-size (d) .note
  34. 34.🌈 Which colour is rgb(0, 255, 0)? (a) blue (b) red (c) bright green (d) white
  35. 35.✍️ What value is given to background-color in this rule?
    li {
      margin: 10px;
      background-color: yellow;
    }
    (a) background-color (b) yellow (c) 10px (d) 8px
  36. 36.📦 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: 15px;
      border: 4px solid black;
      margin: 10px;
    }
  37. 37.🖌️ Which CSS property centres a heading? (a) background-color (b) text-align (c) font-size (d) font-weight
  38. 38.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 18px;
      }
    }
  39. 39.True or false: #main is an element selector. (a) True (b) False
  40. 40.✍️ What is the selector in this CSS rule?
    #top {
      font-weight: bold;
      padding: 8px;
    }
    (a) li (b) font-weight (c) 8px (d) #top

Answer key

  1. JavaScript
  2. white
  3. justify-content
  4. puts boxes in the middle
  5. magenta
  6. the later one
  7. an id selector
  8. many pages
  9. makes letters bigger
  10. purple
  11. 600px or narrower
  12. p
  13. True
  14. F
  15. an element selector
  16. 12
  17. <h2 class="note">
  18. padding
  19. red
  20. an id selector
  21. changes the page live
  22. margin
  23. 255
  24. 22
  25. False
  26. 1
  27. black
  28. .menu
  29. white
  30. white
  31. colours behind the text
  32. yellow
  33. p
  34. bright green
  35. yellow
  36. 228
  37. text-align
  38. 16
  39. False
  40. #top

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