← Text Tags
Basic Text Tags
Understanding common elements used for paragraphs, inline spans, divs, line breaks, and lines.
HTML provides several elements specifically designed for structural text flow and layout container segmentation.
Primary Text Elements
<p>: Paragraph. Block-level container.<span>: Inline text container. Does not add new lines.<div>: Division. Generic block-level container.<br>: Line Break. Moves text to the next line without adding paragraph spacing.<hr>: Horizontal Rule. Represents a thematic break/divider line.
Text Elements Example
html
<p>This is paragraph</p>
<span>Inline Text</span>
<div>Container</div>
<br>
<hr>
Interview questions
Sign in to saveWhat is the difference between a <p>, a <div>, and a <span>?
<p> is block-level and specifically holds text paragraphs (adds margin/padding automatically). <div> is a generic block-level container with no margin/padding. <span> is a generic inline container used to style text segments inline.
Practice
Wrap a text sentence where a single word is highlighted in red, without breaking the paragraph line.
Hint: Use the <span> element with an inline style or class inside a <p> tag.
