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

Answer key

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

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