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?

1 Like

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]]

2 Likes

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

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!

1 Like

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

1 Like

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