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

Answer key

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

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