HTML in Markdown
Most Markdown renderers support inline HTML, giving you access to features Markdown doesn't have natively.
Common HTML Uses
Text Alignment
<p align="center">This text is centered.</p>
Image Sizing
<img src="image.png" width="300" alt="Description">
Details/Accordion
<details>
<summary>Click to expand</summary>
Hidden content goes here.
You can use **Markdown** inside!
</details>
Line Breaks
Line one<br>Line two
Colored Text (limited support)
<span style="color: red;">Red text</span>
Keyboard Keys
Press <kbd>Ctrl</kbd> + <kbd>C</kbd> to copy.
Important Notes
- Not all HTML tags work everywhere (GitHub restricts some)
<script>tags are always blocked for security- Markdown inside HTML blocks may not render (depends on the renderer)
- Use a blank line before and after HTML blocks
- Don't overuse HTML — it defeats the purpose of Markdown's simplicity
Best Practices
- Use HTML only when Markdown can't do what you need
- Keep HTML usage minimal
- Test rendering on your target platform
- Common safe tags:
<br>,<img>,<details>,<kbd>,<sup>,<sub>
💡 Think of HTML in Markdown as a fallback for edge cases, not a primary tool!