Introduction:
In HTML, elements are broadly divided into two categories: block-level and inline. Block elements take up the full width, while inline elements only take as much space as needed.
Example:
This is a paragraph
Explanation: The <p> tag defines a block of text that always starts on a new line.Example:
Example:
"Coding is the new literacy."Explanation: Blockquote is a block container for quotations.
Example
Example:
Explanation:
this is <img> tag, used to insert image
Example: Explanation: this is <audio> tag, used to insert audio.
Example:
Explanation:
this is <video> tag, used to insert videos.
Example:
Google
Explanation:
this is <a> tag, used to generate hyperlinks.
Example:
using <cite> tag
Explanation: This tag is used to note down citetions.
Example: using <b> tag
Explanation: we can bold any text.
Example: using <i> tag
Explanation: we can italic any text.
Example:
Explanation: this is iframe tag, used to embed any required webpage into parent webpage.
Example: <abbr> Explanation: This is used to create abbreviations.
Example:
Explanation: This tag is used to label input fields.
S. No. | Block Elements | Inline Elements |
---|---|---|
1 | It always starts from a new line. | It never starts from new line. |
2 | Stretches to the whole width. | Stretches only to width of its content. |
3 | Divides and Structure the major section of a page. | Used for styling specific text and inline elements. |
3 | Can contain both block and inline elements. | Can only contain inline elements. |
5 | <p>, <h1>, <div>, <ul>, <ol>, <hr>,<br><dl> | <img>, <audio>, <video>, <iframe>, <a>, <cite>, <b>, <i> |