Advanced Elements·19 / 19

HTML in Markdown

Use raw HTML tags for features Markdown doesn't support.

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!

Practice

Markdown Input
Live Preview

HTML in Markdown Practice

Centered Text

This text is centered!

Accordion

Click to see the answer

Markdown was created by John Gruber in 2004!

Keyboard Shortcuts

Press Ctrl + S to save.

Superscript

E = mc2