You may be able to get what you want with CSS snippets.
Can you link to the doc on how does one do this please? I am a backend guy and css means classy something something to me
Put image {align: left; width: 50%;}
in a CSS snippet, and — if you are lucky — every image will occupy 50% of the width of the pane (no matter the pane’s size), and will align left.
You may need to add display: block;
in there to make the alignment work; I forget what layout model images follow by default. Also, you actually want a newer syntax because block
is deprecated, but I forget what the new terms are and this one will work. You can look up the proper version.
Obsidian’s markup is not simple, so you might need to refer to something more specific than image
(probably a certain class of image, like image.whyisthissocomplicated
). To figure out what you need, first search the forum for CSS reference. I know some people have documented at least some of the markup. I think there’s a pinned post somewhere.
If that doesn’t help, go to the menu bar (Mac) or window menus (Windows) and select View
> Toggle Developer Tools
(on Mac, anyway; might be arranged differently on Windows). This will open a sidebar on the right. At the very top left, click on the icon of a pointer in a box (hover for tooltip), then hover over an image in a note. A popup will show you info, the most prominent of which is the selector. In the sidebar you will see the corresponding HTML in the top part and CSS at bottom. Classes in HTML look like class="classyclass"
(a space-separated list means multiple classes); in CSS like .classyclass
.
Note also that you may need to use multiple selectors for the different views (source, live preview, reading).
For general CSS knowledge, see https://developer.mozilla.org/en-US/docs/Web/CSS.
Sorry it’s potentially complicated.
Does this work for you?
.markdown-source-view.mod-cm6 .internal-embed {width: 10%;}
3 Likes
Thank you, james1294. The solution is perfect.
1 Like