Align text, images etc to the right (workaround)

Edit: ignore the other methods to align images to the right, here there is the simplest one:

CC @smos @ari_notes @Ngungu

At the end of an image reference add {:class "right"} like this:

![](image.png){:class "right"}

And in custom.css add these rules (the first will work on desktop, the second on mobile):

.image-resize:has(.right) {float: right;}
.asset-container:has(.right) {float: right;} 

If you want to use :class "something" then replace the two :has(.right) with :has(.something) (notice the dot before the class name).

If you are wondering what’s the syntax to assign multiple classes: {:class "foo bar"} (I use a second class to invert the color of images in the dark mode).


Here there is the Hiccup to align an image to the right instead (with the method #2 explained above):

[:img {:src "assets:///path/to/graph/assets/example.png" :class ra}]

or you can use any URL (with https://) instead of the link to an asset of yours like the above.

Result:

4 Likes