← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 667 · 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 property is set to italic in this rule?
    li {
      text-align: center;
      font-style: italic;
    }
    (a) font-style (b) color (c) font-size (d) italic
  2. 2.🌈 Which colour is rgb(0, 255, 0)? (a) cyan (b) white (c) red (d) bright green
  3. 3.Which of these does JavaScript do? (a) shows a pop-up message (b) makes headings and lists (c) makes a link (d) changes the text size
  4. 4.✍️ Which sign goes between a property and its value? (a) ; (b) - (c) : (d) =
  5. 5.🎯 Which CSS selector matches this element?
    <p class="red" id="top">Hello</p>
    (a) #intro (b) #red (c) p (d) .top
  6. 6.📱 The screen is 820px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 16px;
      }
    }
    (a) No (b) Yes
  7. 7.🎯 Can many elements share the same class? (a) Yes (b) No
  8. 8.🎯 What kind of selector is .star? (a) an element selector (b) a class selector (c) an id selector
  9. 9.What does color do? (a) makes the text bold (b) makes letters bigger (c) sets the letter colour (d) picks the font style
  10. 10.⚖️ What colour is the text of this element?
    <h1 class="menu" id="main">Hi</h1>
    CSS:
    h1 { color: purple; }
    h1 { color: green; }
    (a) purple (b) green (c) blue (d) white
  11. 11.True or false: the border is a solid or dotted edge. (a) False (b) True
  12. 12.⚖️ What colour is the text of this element?
    <h1 class="red" id="top">Hi</h1>
    CSS:
    .red { color: white; }
    #top { color: blue; }
    h1 { color: black; }
    (a) black (b) red (c) blue (d) white
  13. 13.⚖️ What colour is the text of this element?
    <h2 class="big" id="intro">Hi</h2>
    CSS:
    .big { color: yellow; }
    h2 { color: blue; }
    (a) white (b) blue (c) yellow (d) purple
  14. 14.🎯 Which element does the selector #intro style? (a) <div id="main"> (b) <span class="box"> (c) <div class="intro"> (d) <div id="intro">
  15. 15.True or false: padding is the gap to other boxes. (a) False (b) True
  16. 16.Which of these does HTML do? (a) gives the page structure (b) counts down a timer (c) reacts to a button click (d) lays out the page
  17. 17.🎨 Which tag connects an outside CSS file? (a) <css> (b) <link> (c) <img> (d) <a>
  18. 18.✍️ How many declarations (property: value pairs) are in this rule?
    p {
      font-size: 20px;
      margin: 10px;
    }
  19. 19.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 12px;
      }
    }
  20. 20.⚖️ What colour is the text of this element?
    <p class="red" id="top">Hi</p>
    CSS:
    p { color: yellow; }
    p { color: orange; }
    (a) blue (b) white (c) orange (d) yellow
  21. 21.✍️ What value is given to font-size in this rule?
    h1 {
      text-align: center;
      font-size: 20px;
    }
    (a) 20px (b) yellow (c) center (d) font-size
  22. 22.🎯 Which element does the selector .box style? (a) <div class="box"> (b) <div id="box"> (c) <span class="menu"> (d) <div class="star">
  23. 23.🔍 Which is the odd one out? (a) puts a picture on a page (b) makes a form box (c) makes headings and lists (d) lays out the page
  24. 24.⚖️ What colour is the text of this element?
    <p class="big" id="intro">Hi</p>
    CSS:
    .big { color: blue; }
    .big { color: orange; }
    (a) black (b) green (c) orange (d) blue
  25. 25.True or false: margin is a solid or dotted edge. (a) True (b) False
  26. 26.True or false: HTML adds space around boxes. (a) False (b) True
  27. 27.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 60px;
      padding: 10px;
      border: 4px solid black;
      margin: 5px;
    }
  28. 28.💪 Which justify-content value puts boxes in the middle? (a) space-between (b) flex-start (c) center (d) flex-end
  29. 29.🌈 What is the biggest number one colour can have in rgb()? (a) 100 (b) 99 (c) 1000 (d) 255
  30. 30.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 10px;
      }
    }
  31. 31.✍️ What value is given to padding in this rule?
    li {
      font-size: 20px;
      padding: 8px;
    }
    (a) 2px solid (b) padding (c) 8px (d) bold
  32. 32.🎯 How many elements on a page should have the same id? (a) 2 (b) 5 (c) 1 (d) any number
  33. 33.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 410px;
      justify-content: space-between;
    }
    Inside are 4 boxes, each 80px wide (no margins).
  34. 34.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 20px;
      }
    }
    (a) Yes (b) No
  35. 35.📦 In the box model, which part is the text or picture? (a) padding (b) margin (c) content (d) border
  36. 36.🔍 Which is the odd one out? (a) makes a link (b) counts down a timer (c) puts a picture on a page (d) makes a form box
  37. 37.🖌️ Which CSS property picks the font style? (a) font-weight (b) color (c) font-family (d) text-align
  38. 38.✍️ What is the selector in this CSS rule?
    p {
      font-style: italic;
      text-align: center;
    }
    (a) center (b) p (c) font-style (d) .note
  39. 39.📱 The screen is 414px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 18px;
      }
    }
    (a) Yes (b) No
  40. 40.✍️ How many declarations (property: value pairs) are in this rule?
    h2 {
      padding: 8px;
    }

Answer key

  1. font-style
  2. bright green
  3. shows a pop-up message
  4. :
  5. p
  6. Yes
  7. Yes
  8. a class selector
  9. sets the letter colour
  10. green
  11. True
  12. blue
  13. yellow
  14. <div id="intro">
  15. False
  16. gives the page structure
  17. <link>
  18. 2
  19. 16
  20. orange
  21. 20px
  22. <div class="box">
  23. lays out the page
  24. orange
  25. False
  26. False
  27. 98
  28. center
  29. 255
  30. 10
  31. 8px
  32. 1
  33. 30
  34. No
  35. content
  36. counts down a timer
  37. font-family
  38. p
  39. No
  40. 1

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