Css class not working in markdown



I’m trying to add a css class in markdown, I’m using Kramdown.

This is my attempt:

<div class="rightalign">![alt text.](/image.jpg)

The markdown works on its own (it displays the image), but when I add the div it doesn’t.

Any ideas would be great!


I think you can add a class to the actual image element like this:

![alt text.](/image.jpg) {: .my-cool-class }


Not sure about the way you are doing it by wrapping the image in a div and giving the div the class.


rdyar is right

![alt text](/image.jpg){:.css_class}


But the confusion is understandable since when dealing with texts the class spec should be placed in front (at least that is my experience):

{:.css_class} My line of text



Thanks Rdyar.

Probably worth noting that if there’s a space between the closing bracket and the curly brace it doesn’t work (at least for me anyway).