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

Answer key

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

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