Skip to content

Changing css for html created from markdown in sublime text

I am a big fan of writing in Markdown. I am also a big fan of Sublime Text. Naturally, I’ve been using the Markdown Preview plugin a lot.

Whenever I produce html files using the markdown parser, the page wasn’t responsive. The width of <body> was bigger than the screen for smaller screens. So I decided to tweak the default css a little bit. This way I could write my own css one day if I wanted to. Here’s how to use a custom css file for the output html files.

  1. Create a css file in the Sublime Text folder. On Windows this is usually C:\Program Files\Sublime Text 3.
  2. In sublime text, Preferences -> Package Settings -> Markdown Preview -> Settings - User
  3. Put this in the settings file that should have opened.
{
/*
Any other settings
*/
"css": ["markdown.css"]
}