← CSS rules: selector, property, value lesson New set →

CSS Worksheet: CSS Rules and Syntax

HTML and CSS lesson 12: CSS rules: selector, property, value · Set 205 · 40 questions
TalentJR

Code tip (Colon in the middle, semicolon at the end): A rule is: selector { property: value; property: value; } The property is before the colon, the value after it; a semicolon ends each declaration. Count the property: value; lines to count the declarations.

NameDateTime takenScore ___ / 40
  1. 1.✍️ Which property is set to bold in this rule?
    .note {
      font-weight: bold;
      font-style: italic;
      border: 2px solid;
    }
    (a) bold (b) width (c) font-weight (d) border
  2. 2.✍️ Which property is set to 20px in this rule?
    .box {
      font-style: italic;
      font-weight: bold;
      font-size: 20px;
      margin: 10px;
    }
    (a) text-align (b) background-color (c) 20px (d) font-size
  3. 3.✍️ How many declarations (property: value pairs) are in this rule?
    h2 {
      width: 300px;
    }
  4. 4.✍️ How many declarations (property: value pairs) are in this rule?
    .box {
      font-style: italic;
    }
  5. 5.✍️ How many declarations (property: value pairs) are in this rule?
    h2 {
      border: 2px solid;
    }
  6. 6.✍️ How many declarations (property: value pairs) are in this rule?
    p {
      font-size: 20px;
      font-weight: bold;
      width: 300px;
    }
  7. 7.✍️ What value is given to background-color in this rule?
    li {
      background-color: yellow;
      border: 2px solid;
    }
    (a) background-color (b) 10px (c) yellow (d) 8px
  8. 8.✍️ What value is given to text-align in this rule?
    body {
      text-align: center;
      padding: 8px;
    }
    (a) text-align (b) 10px (c) center (d) yellow
  9. 9.✍️ What value is given to margin in this rule?
    .note {
      color: red;
      margin: 10px;
    }
    (a) margin (b) 8px (c) 10px (d) bold
  10. 10.✍️ What value is given to font-style in this rule?
    li {
      border: 2px solid;
      font-style: italic;
      padding: 8px;
    }
    (a) italic (b) 20px (c) font-style (d) red
  11. 11.✍️ What value is given to font-size in this rule?
    h1 {
      text-align: center;
      font-size: 20px;
      font-style: italic;
    }
    (a) center (b) 20px (c) yellow (d) font-size
  12. 12.✍️ How many declarations (property: value pairs) are in this rule?
    h2 {
      padding: 8px;
    }
  13. 13.✍️ Which sign ends each CSS declaration? (a) , (b) : (c) ; (d) .
  14. 14.✍️ What value is given to border in this rule?
    h2 {
      font-weight: bold;
      font-size: 20px;
      width: 300px;
      border: 2px solid;
    }
    (a) border (b) 2px solid (c) italic (d) 300px
  15. 15.✍️ What value is given to background-color in this rule?
    p {
      margin: 10px;
      background-color: yellow;
      font-style: italic;
    }
    (a) yellow (b) 10px (c) 8px (d) background-color
  16. 16.✍️ Which property is set to bold in this rule?
    .note {
      width: 300px;
      font-weight: bold;
    }
    (a) border (b) font-weight (c) bold (d) width
  17. 17.✍️ How many declarations (property: value pairs) are in this rule?
    #top {
      font-style: italic;
      width: 300px;
      text-align: center;
    }
  18. 18.✍️ What value is given to padding in this rule?
    body {
      font-weight: bold;
      text-align: center;
      padding: 8px;
    }
    (a) 2px solid (b) bold (c) 8px (d) padding
  19. 19.✍️ How many declarations (property: value pairs) are in this rule?
    .note {
      color: red;
      padding: 8px;
      background-color: yellow;
    }
  20. 20.✍️ How many declarations (property: value pairs) are in this rule?
    #top {
      width: 300px;
      padding: 8px;
      text-align: center;
    }
  21. 21.✍️ How many declarations (property: value pairs) are in this rule?
    p {
      border: 2px solid;
    }
  22. 22.✍️ What value is given to color in this rule?
    body {
      color: red;
      margin: 10px;
    }
    (a) 20px (b) center (c) color (d) red
  23. 23.✍️ In color: blue; which part is the value? (a) : (b) ; (c) blue (d) color
  24. 24.✍️ What is the selector in this CSS rule?
    h1 {
      color: red;
      text-align: center;
      border: 2px solid;
      font-style: italic;
    }
    (a) color (b) h1 (c) center (d) p
  25. 25.✍️ Which sign goes between a property and its value? (a) ; (b) - (c) = (d) :
  26. 26.✍️ How many declarations (property: value pairs) are in this rule?
    #top {
      font-size: 20px;
    }
  27. 27.✍️ How many declarations (property: value pairs) are in this rule?
    .note {
      padding: 8px;
    }
  28. 28.✍️ How does a CSS comment start? (a) <!-- (b) /* (c) // (d) #
  29. 29.✍️ What value is given to color in this rule?
    .note {
      width: 300px;
      border: 2px solid;
      color: red;
      text-align: center;
    }
    (a) center (b) color (c) 20px (d) red
  30. 30.✍️ Which property is set to 10px in this rule?
    body {
      font-style: italic;
      margin: 10px;
    }
    (a) padding (b) 10px (c) margin (d) font-weight
  31. 31.✍️ What is the selector in this CSS rule?
    h2 {
      border: 2px solid;
      font-style: italic;
    }
    (a) h2 (b) border (c) h1 (d) italic
  32. 32.✍️ What value is given to color in this rule?
    .note {
      font-size: 20px;
      border: 2px solid;
      padding: 8px;
      color: red;
    }
    (a) red (b) color (c) center (d) 20px
  33. 33.✍️ In color: blue; which part is the property? (a) color (b) : (c) ; (d) blue
  34. 34.✍️ What is the selector in this CSS rule?
    #top {
      font-weight: bold;
      background-color: yellow;
    }
    (a) yellow (b) li (c) font-weight (d) #top
  35. 35.✍️ Which property is set to italic in this rule?
    h2 {
      margin: 10px;
      text-align: center;
      font-style: italic;
    }
    (a) font-size (b) font-style (c) italic (d) color
  36. 36.✍️ What is the selector in this CSS rule?
    h2 {
      color: red;
      font-size: 20px;
      background-color: yellow;
    }
    (a) h1 (b) h2 (c) 20px (d) color
  37. 37.✍️ Which property is set to red in this rule?
    h2 {
      padding: 8px;
      text-align: center;
      background-color: yellow;
      color: red;
    }
    (a) text-align (b) red (c) color (d) font-size
  38. 38.✍️ How many declarations (property: value pairs) are in this rule?
    li {
      text-align: center;
      background-color: yellow;
      border: 2px solid;
      padding: 8px;
    }
  39. 39.✍️ What value is given to color in this rule?
    h1 {
      text-align: center;
      font-weight: bold;
      color: red;
      background-color: yellow;
    }
    (a) color (b) center (c) 20px (d) red
  40. 40.✍️ Which property is set to italic in this rule?
    p {
      font-weight: bold;
      font-style: italic;
    }
    (a) italic (b) font-style (c) font-size (d) color

Answer key

  1. font-weight
  2. font-size
  3. 1
  4. 1
  5. 1
  6. 3
  7. yellow
  8. center
  9. 10px
  10. italic
  11. 20px
  12. 1
  13. ;
  14. 2px solid
  15. yellow
  16. font-weight
  17. 3
  18. 8px
  19. 3
  20. 3
  21. 1
  22. red
  23. blue
  24. h1
  25. :
  26. 1
  27. 1
  28. /*
  29. red
  30. margin
  31. h2
  32. red
  33. color
  34. #top
  35. font-style
  36. h2
  37. color
  38. 4
  39. red
  40. font-style

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