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

Answer key

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

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