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

Answer key

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

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