Welcome to Peter's Website

  1. What are different parts of a CSS style rule?

  2. There are two parts of a CSS Style rule, they are the Selector and the Declaration.

  3. What are an element selector and grouped element selector in CSS? Provide an example of each.

  4. An Element selector selects all elements that you specified. Grouped element selectors are quite similar however they have multiple elements.


    Element Selector Grouped Selector
    p{color: red; font-size: 5px;} h1, h2, p {color: blue; text-align: center;}

  5. What are class selectors in CSS? What are id selectors in CSS?

  6. Class selectors use an attribute from another element to specify the style of the element it is in while id selectors are a specific part of a HTML tag to specify a specific style for just that element.

  7. What are contextual selectors in CSS?

  8. Contextual selectors allow you to specify different styles for different parts of your webpage. You can assign styles directly to specific HTML tags or you can create independent classes and assign them to tags in the HTML.

  9. What are the three cascade principles used by browsers when style rules conflict?

  10. The three cascade principles used by browsers when style rules conflict are If the cascade results in a value then use it. If the property is inherited then use the computed value of the parent element and finally Use the property's initial value.