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

Answer key

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

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