Module 4: DIV, SPAN, Class, ID, and Child Selectors

1. DIV and SPAN

A <div> is a block-level element, often used to group sections of a page.

This is a div element with its own styling.

A <span> is an inline element used to style part of a sentence, like this highlighted text.

2. Class and ID

We use classes (with a period `.`) to style multiple elements consistently.

This paragraph uses the .highlight class.

We use IDs (with a hash `#`) for unique elements.

This box uses the ID #unique-id.

3. Child Selector

This paragraph is a direct child of the container div and is styled using the .container > p selector.

This paragraph is inside another div and is not affected by the child selector.