Inline elements let you style or organize small parts of text or content without breaking the flow of the paragraph or line.
Inline elements in HTML
<tagname>content</tagname>
<strong>Important</strong>
<a href="https://example.com">Visit site</a>
<em>Note</em>
<span style="color: red;">Red text</span>
This example shows different inline elements inside paragraphs. The text stays on the same line except where it naturally wraps. The strong and em tags style words bold and italic. The a tag creates a clickable link with an accessible label. The span adds a yellow background highlight. The img tag inserts a small icon aligned with the text.
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Inline Elements Example</title> <style> .highlight { background-color: yellow; } </style> </head> <body> <p>This is a <strong>bold</strong> word, an <em>italic</em> word, and a <a href="https://example.com" aria-label="Example website">link</a> inside a sentence.</p> <p>Here is a <span class="highlight">highlighted text</span> inside the paragraph.</p> <p>And here is an inline image <img src="https://via.placeholder.com/20" alt="small icon" style="vertical-align: middle;"> inside text.</p> </body> </html>
Inline elements do not cause line breaks, so they keep content flowing smoothly.
Use aria-label on links or images for better accessibility.
Images inside text should have alt text and be sized appropriately to blend well.
Inline elements style or organize small parts of content without breaking lines.
Common inline tags include strong, em, a, span, and img.
They keep text flowing naturally and help make content clearer and more interactive.