Last active
August 27, 2022 21:05
-
-
Save mostafa-asg/bd6700f4475f68730b4ea3bf12afe7ee to your computer and use it in GitHub Desktop.
centering images in Hugo - Based on this article : (http://www.ebadf.net/2016/10/19/centering-images-in-hugo/)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
img[src$='#center'] | |
{ | |
display: block; | |
margin: 0.7rem auto; /* you can replace the vertical '0.7rem' by | |
whatever floats your boat, but keep the | |
horizontal 'auto' for this to work */ | |
/* whatever else styles you fancy here */ | |
} | |
img[src$='#floatleft'] | |
{ | |
float:left; | |
margin: 0.7rem; /* this margin is totally up to you */ | |
/* whatever else styles you fancy here */ | |
} | |
img[src$='#floatright'] | |
{ | |
float:right; | |
margin: 0.7rem; /* this margin is totally up to you */ | |
/* whatever else styles you fancy here */ | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
then, inside your Markdown content, pull in the images as follows: | |
![your_img_alt_text](/img/your_img.png#center) | |
![your_img_alt_text](/img/your_img.png#floatleft) | |
![your_img_alt_text](/img/your_img.png#floatright) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment