In HTML, elements are divided into two main display categories: block-level elements and inline elements.
- Block-Level Elements
A. Behavior: Start on a new line and automatically stretch to fill the full width of their container.
B. Layout: Can have width, height, margin, and padding set on all four sides.
C. Purpose: Used to build the main structural layout of a web page.
Common Examples:
,,
to
, , , - , , .
- Inline Elements
A. Behavior: Do not start on a new line; they sit side-by-side within the flow of text.
B Layout: Only take up as much width as their content requires. Setting width and height properties has no effect, and top/bottom margins are ignored.
c Purpose: Used to format or apply styles to specific words or small inline portions of text.
Common Examples: , , , ,
, .
- ,
- , , .
- Inline Elements
A. Behavior: Do not start on a new line; they sit side-by-side within the flow of text.
B Layout: Only take up as much width as their content requires. Setting width and height properties has no effect, and top/bottom margins are ignored.
c Purpose: Used to format or apply styles to specific words or small inline portions of text.
Common Examples: , , , ,
, .
Top comments (0)