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

Answer key

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

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