My main problem with Markdown is that I'm unable to give classes to images. I like to have classes for everything. The benefits I have from giving classes to nearly every element is that I'm in full control when I design a website. If I'm using a lossy mix of direct selectors and classes it becomes messy.
However, let's assume I'm writing an article with a lot of images. I don't want them all to just "be" there, I want to style them. I want them to float to the left and right, have borders or apply shadows or whatever else. I want to use the full potential of CSS.
The markup for images in Markdown is pretty simple as you can see below:

You can apply an alt Text by writing it between
[
and
]
, an title Attribute can also be set by writing it in quotes right after the URL or PATH of the image. The only way I found to apply a specific style to images in Markdown is "hacking" into the
title
or
alt
Attribute. I decided to do it with the
title
, it would work the same way with alt.
First we define an image in Markdown. It's the same you can see above.
Notice: It is already styled by CSS (see line 23)

The next step is to apply a title Attribute to the image.

We'll now use this title Attribute to style specific images.
To use our "hacked" class we now need to use a special CSS Selector Method: The Attribute Selector. With the Attribute Selector you can easily access an Attribute, similar to styling an
h2
an Attribute Selector Style applies to all matching elements. In our case we'll likely want to address images only.
The markup is pretty easy:
img[title*="imgClass--rounded"] {
-webkit-border-radius:3px;
-moz-border-radius:3px;
border-radius:3px;
}
This small snippet simply points to "an image with a title attribute that contains imgClass--rounded". There are other selectors like that, e.g.
a[href$="https"]
,
input[type="text"]
,
div[class^="whatever"]
- I'll maybe cover them in a blog post.
To prevent conflicts I decided to name all "classes" I apply to the image
imgClass--
followed by the name. Below you can see some examples, hover them to get the Title attribute, the last word always represents the "class".
Another use-case could be to float an image to the right or left as shown below.
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
That's it. Suggestions can be sent directly via twitter