I’m following this thread: Center images using CSS
I’m hoping the image will be centered but it is not. Can someone help explain why this is not working? Thank you!
I can get it to show up with the size indicator. Maybe it is the extra periods in your filename that are throwing it off when inside html tags. Except I just tested that and it works too… And I tested a filename with both a period and a space in it. It worked too. Weird.
But again, I really have a feeling this is unsupported.
I can get it to show up with the size indicator. Maybe it is the extra periods in your filename that are throwing it off when inside html tags. Except I just tested that and it works too… And I tested a filename with both a period and a space in it. It worked too. Weird.
@rigamarole So the exact same code I’m using works for you but not for me? That’s interesting.
When you say you tested a filename, can you post the CSS and markdown/html you used to make it work? Thanks
It’s a common way for Markdown to behave, plus I’ve seen moderators state it more than once. Here’s an example which also links to some related feature requests:
I don’t see it documented in Help (based on a search for “HTML”).
alternative to @CawlinTeffid suggestion, you may also use a combination of css and Markdown Attributes plugin. the downside is that it works with reading view only.
example markdown
![[filename.jpg|200]] { .center-img }
css per below. the plugin add the .center-img class to span containing the <img> tag
Thanks, but of course the downside is that the link becomes fragile and that link flexibility is precisely why I use Obsidian. However it is probably the approach I’ll have to take in the meantime, so I appreciate you giving this to me.
EDIT: I tried this approach and strangely it did not work for me, meaning no image is displayed at all. The file exists and is valid.
<img class='centerImg' src='/Volumes/2_TB_SSD_external/Projects_2TB/computers-and-geekery/projects and languages/Obsidian development/wealthyvault/assets/2022-09-27.11.58.45.CleanShot.Finder 1.png'>
file '/Volumes/2_TB_SSD_external/Projects_2TB/computers-and-geekery/projects and languages/Obsidian development/wealthyvault/assets/2022-09-27.11.58.45.CleanShot.Finder 1.png'
/Volumes/2_TB_SSD_external/Projects_2TB/computers-and-geekery/projects and languages/Obsidian development/wealthyvault/assets/2022-09-27.11.58.45.CleanShot.Finder 1.png: PNG image data, 546 x 303, 8-bit/color RGBA, non-interlaced
Maybe you need to add file:// to the start of the path and/or URL encode the path? (In this case I think encoding just means replacing all the spaces with %20.)
True. But hopefully you’re less likely to move or rename your image files than your notes?