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

Answer key

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

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