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

Answer key

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

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