Updated 2021-12-22
This functionality is now available in Minimal Theme combined with Contextual Typography v2.2.1 — read the Minimal 4.2 release notes for more detail.
Documentation for Image Grids can be found here:
Archived post (before Obsidian v0.11.3)
A simple snippet that you can pair with the new cssclass YAML code (as of 0.9.19). Add cssclass: img-grid to your front matter to display images in columns. Pairs nicely with Image zoom: click + hold to expand images
Saving the snippet (0.9.19+)
Save this snippet as img-grid.css and add it to .obsidian/snippets folder in your vault. You can then turn it on from the Appearance settings.
/* Updated for Obsidian 0.9.22 and up */
.img-grid .markdown-preview-section img:not([width]),
.img-grid .markdown-preview-section video {
width:100%;
}
.img-grid .markdown-preview-section > div {
display:flex;
}
.img-grid .markdown-preview-section > div > .internal-embed {
flex:1;
margin-left:-0.5rem;
padding:0 0.5rem 0.5rem 0.5rem;
}
.img-grid .markdown-preview-section > div > *:not(div) {
margin-block-start: 0rem;
margin-block-end: 1rem;
}
.img-grid .markdown-preview-section > div hr {
width:100%;
}
/* These lines make every image the same height */
.img-grid .markdown-preview-section > div > .internal-embed img:not(:active) {
object-fit:cover;
height:100%;
}
Usage
In edit mode, add cssclass: img-grid to your frontmatter. Then simply group your images by adding an extra line break between each row. The code will automatically create equal size columns for each image.
Demo
This is paired with Image zoom: click + hold to expand images