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

Answer key

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

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