How to center an image automatically with minimal theme and image auto upload plugin?

I used the minimal theme and image auto upload plugin for my obsidian. I found that the image was left-aligned. How to change the setting to make the images center aligned automatically?

2 Likes

I use this CSS snippet for image alignment. I’m not sure if it’s possible to make it happen automatically, but all you have to do is add |center to the end of an image embed, e.g. ![[image.png|center]]

19 Likes

Thank you for your suggestion. This solution needs to modify the code image by image.

1 Like

Hello there @hqgu . Let me know if this snippet works:

img {
        display: block !important;
        margin-left: auto !important;
        margin-right: auto !important;
}
    
 .markdown-source-view.mod-cm6 .cm-content > * {
        margin: auto auto !important;
}

This should center images, embeds automagically!

27 Likes

Hi @Cecilia_May , thank you for your help. Your CSS code works well!

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.