Aligning image
To align images in Obsidian, a custom CSS snippet is needed. Once it is set, this allows you to center or right-align images while scaling the image size.
Step 1: Create a CSS snippet
- Navigate to the snippets folder in your Obsidian Vault.
- Create a new file called
Image Align.css
and add the following CSS code.
img[alt*="center"] {
display: block;
margin-left: auto;
margin-right: auto;
}
img[alt*="right"] {
float:right;
clear:right;
margin-left: 1rem;
margin-bottom: 2px;
margin-top: 2px;
}
Step 2: Activate the Snippet
- Go to Settings → Appearance
- Scroll down to CSS Snippet
- Turn Image Align in the list ON.
Step 3: Insert an Align an Image
- Insert an image
- To specify alignment and sizer, modify the syntax as
!
[[picture name|center|350]]
right or center
: Aligns the image to the right or center.100
: Scales the image to 100 pixels in width.