← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 683 · 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 of these does HTML do? (a) shows a pop-up message (b) lays out the page (c) makes a link (d) rounds box corners
  2. 2.✍️ What value is given to font-style in this rule?
    #top {
      font-style: italic;
      font-size: 20px;
      border: 2px solid;
      width: 300px;
    }
    (a) 20px (b) red (c) italic (d) font-style
  3. 3.True or false: #main is an id selector. (a) True (b) False
  4. 4.🧩 Which language sets colours and fonts? (a) HTML (b) JavaScript (c) CSS
  5. 5.⚖️ Which selector is the strongest? (a) an element selector (b) a class selector (c) an id selector
  6. 6.🔍 Which is the odd one out? (a) makes a form box (b) puts a picture on a page (c) makes headings and lists (d) adds space around boxes
  7. 7.✍️ What value is given to color in this rule?
    h2 {
      color: red;
      border: 2px solid;
      background-color: yellow;
      font-size: 20px;
    }
    (a) center (b) 20px (c) color (d) red
  8. 8.🖌️ Which CSS property colours behind the text? (a) font-family (b) background-color (c) color (d) font-size
  9. 9.✍️ How many declarations (property: value pairs) are in this rule?
    .note {
      color: red;
      font-style: italic;
    }
  10. 10.⚖️ What colour is the text of this element?
    <h2 class="star" id="hero">Hi</h2>
    CSS:
    h2 { color: purple; }
    .star { color: blue; }
    (a) blue (b) purple (c) white (d) orange
  11. 11.🖌️ Which CSS property makes the text bold? (a) font-size (b) font-weight (c) background-color (d) color
  12. 12.✍️ How does a CSS comment start? (a) /* (b) // (c) # (d) <!--
  13. 13.🖌️ How big is the text, in px?
    h1 {
      color: green;
      text-align: center;
      font-size: 16px;
      background-color: black;
    }
  14. 14.✍️ What is the selector in this CSS rule?
    .note {
      color: red;
      margin: 10px;
    }
    (a) 10px (b) #top (c) .note (d) color
  15. 15.🎨 A CSS file usually ends with which extension? (a) .html (b) .css (c) .png (d) .js
  16. 16.⚖️ What colour is the text of this element?
    <p class="big" id="top">Hi</p>
    CSS:
    #top { color: yellow; }
    #top { color: blue; }
    (a) yellow (b) blue (c) black (d) green
  17. 17.💪 Which justify-content value puts boxes in the middle? (a) flex-start (b) flex-end (c) space-between (d) center
  18. 18.🌈 Hex digits go 0 to 9, then A to which letter? (a) J (b) Z (c) G (d) F
  19. 19.✍️ How many declarations (property: value pairs) are in this rule?
    .note {
      background-color: yellow;
    }
  20. 20.🖌️ Which CSS property picks the font style? (a) font-family (b) font-size (c) color (d) background-color
  21. 21.📱 max-width: 600px applies when the screen is ___. (a) turned off (b) 600px or narrower (c) 600px or wider (d) exactly 1000px
  22. 22.💪 Which flexbox property turns on flexbox? (a) align-items (b) display: flex (c) flex-direction (d) justify-content
  23. 23.True or false: #top is a class selector. (a) True (b) False
  24. 24.🎯 Which element does the selector #end style? (a) <h2 class="box"> (b) <h1 class="end"> (c) <h1 id="hero"> (d) <h1 id="end">
  25. 25.📦 In the box model, which part is the gap round content? (a) content (b) padding (c) margin (d) border
  26. 26.🖌️ Where does the text sit on its line?
    h1 {
      font-size: 28px;
      background-color: blue;
      text-align: right;
      color: red;
    }
    (a) on the right (b) on the left (c) in the middle
  27. 27.🔍 Which is the odd one out? (a) lays out the page (b) checks a quiz answer (c) changes the text size (d) rounds box corners
  28. 28.True or false: the content is the text or picture. (a) False (b) True
  29. 29.🧩 Which language lays out the page? (a) JavaScript (b) HTML (c) CSS
  30. 30.True or false: CSS checks a quiz answer. (a) True (b) False
  31. 31.⚖️ What colour is the text of this element?
    <p class="note" id="end">Hi</p>
    CSS:
    p { color: purple; }
    #end { color: yellow; }
    .note { color: red; }
    (a) red (b) yellow (c) white (d) purple
  32. 32.Which of these does JavaScript do? (a) checks a quiz answer (b) changes the text size (c) makes a link (d) sets colours and fonts
  33. 33.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 6px;
      }
    }
    (a) No (b) Yes
  34. 34.⚖️ What colour is the text of this element?
    <h2 class="big" id="intro">Hi</h2>
    CSS:
    .big { color: orange; }
    #intro { color: green; }
    (a) blue (b) black (c) green (d) orange
  35. 35.🎯 What kind of selector is img? (a) a class selector (b) an element selector (c) an id selector
  36. 36.✍️ What value is given to text-align in this rule?
    h2 {
      text-align: center;
      padding: 8px;
      margin: 10px;
      background-color: yellow;
    }
    (a) center (b) text-align (c) 10px (d) yellow
  37. 37.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 14px;
      }
    }
  38. 38.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 18px;
      }
    }
  39. 39.✍️ What value is given to color in this rule?
    p {
      color: red;
      font-style: italic;
      text-align: center;
    }
    (a) color (b) center (c) 20px (d) red
  40. 40.Which of these does HTML do? (a) adds space around boxes (b) makes a form box (c) sets colours and fonts (d) changes the page live

Answer key

  1. makes a link
  2. italic
  3. True
  4. CSS
  5. an id selector
  6. adds space around boxes
  7. red
  8. background-color
  9. 2
  10. blue
  11. font-weight
  12. /*
  13. 16
  14. .note
  15. .css
  16. blue
  17. center
  18. F
  19. 1
  20. font-family
  21. 600px or narrower
  22. display: flex
  23. False
  24. <h1 id="end">
  25. padding
  26. on the right
  27. checks a quiz answer
  28. True
  29. CSS
  30. False
  31. yellow
  32. checks a quiz answer
  33. Yes
  34. green
  35. an element selector
  36. center
  37. 20
  38. 18
  39. red
  40. makes a form box

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