What is a Block Tag and an Inline Tag?
What is a Block Tag?
A block tag (or block-level element) is an HTML element that starts on a new line and takes up the full width available (stretches out to the left and right as far as it can). Examples of block tags include <div>, <p>, <h1>, and <section>.
What is an Inline Tag?
An inline tag (or inline-level element) does not start on a new line and only takes up as much width as necessary. Inline elements are typically used for smaller chunks of content within block-level elements. Examples include <span>, <a>, <img>, and <strong>.
Difference Between Block and Inline Tag
Block Tags:
- Start on a new line.
- Take up the full width available by default.
- Can contain other block and inline elements.
- Examples:
<div>,<p>,<h1>,<ul>,<li>.
Inline Tags:
- Do not start on a new line.
- Only take up as much width as necessary.
- Cannot contain block elements.
- Examples:
<span>,<a>,<img>,<strong>.
.png)
Comments
Post a Comment