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

Answer key

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

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