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

Answer key

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

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