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

Answer key

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

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