Skip to content(if available)orjump to list(if available)

CSS for Styling a Markdown Post

CSS for Styling a Markdown Post

5 comments

·October 7, 2025

Brajeshwar

Writing CSS for Markdown is Writing CSS for the standard HTML elements. This is where those Classless CSS works pretty well. Pick the one you like and then add your own. That should keep the CSS file size low enough to be negligible and sometime even embed in your HTML.

- <https://classless.de>

- <https://github.com/dbohdan/classless-css>

Gualdrapo

The article mentions targeting both `<picture>` and `<img>` elements, but that is redundant - just target `<img>`s. `<picture>` has to have one `<img>` node anyway.

bryanhogan

Thanks for this! Gonna update the post.

byhemechi

I personally always use

  picture {
    display: contents;
  }
so that flexbox behaves in a way you would expect.