CST8238 Computer Engineering Technology - Computing Science

(i) What are main benefits of using CSS?

What are the main benefits of using CSS

CSS allows web developers/designers to create a style that is separate to the content of the page.

What are different parts of a CSS style rule?

tag {property-value; property-value;}

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

Element selectors select all instances of a given HTML element.
A group selector follows the same principle with the exception that it can take multiple elements.
Group selector example: p, div, aside{ margin: 0; padding 0;} Element selector example: em{ color: red;}

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

A class selector allows you to simultaneously target different HTML elements regardless of their position in the document tree.
An id selector allows you to target a specific element by its id attribute regardless of its type or position.

What are contextual selectors in CSS?

A contextual selector allows you to select elements based on their ancestors, descendents, or siblings.

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

The three cascade principles are inheritance, specificity, and location.