How customise image size in *.md files?

In my blog, I inserted several images, and their size are small, but after render by Hugo, these images are zoomed in. How to insert a image with original size?

I don’t think your problem has anything to do with Hugo, since Hugo isn’t modifying image size in any way. I suspect a CSS rule is enlarging the images on display. You may have something along those lines in your theme’s stylesheet:

img {
    width: 100%;

Ty, but it doesn’t work

Dear Dawnarc, this is CSS problem in your theme, are you using bootstrap to do responsive images? if yes than add img-responsive call or just add height and width in your IMG tag to see and than redefine your css to make it beautiful.

Hi dawnarc,

    max-width: 100%;
    height: auto;

Thx very much! I found the reason: I added img style in in my theme css before, now I have remove it and it works right

 .content-card img {
    width: 100%;
1 Like

max-width instead of width works instead of width for portrait images which are not of full resolution as the screen width

 .content-card img {
    max-width: 100%;

Awesome! it works! Thx so much !

I’m new to Hugo and am having the same problem with images getting enlarged so that they’re all the maximum width.
I have tried using figure shortcode:

but that doesn’t do anything (even if I do width=“10%” or width=“10px”)

Can you explain how I can override the default width?

Thank you!

You should be able to overwrite the default value for the width by using a local css style like this:
<img class="special-img-class" style="width:100%" src="photo.png" />
the width=“100%” should set the width of that picture to 100%.

Hi Joel,
I’ve tried both of the following and neither work:

<img class=“special-img-class” width=“100%” src=furnace_small.jpg">

The first line doesn’t even create an image, the second creates the image
but it’s still blown up to more than full size.
I’m typing this line into the .md file – is that correct?
Is there anything else I need to change or add for this to work?


It could be a copy-paste error, but just in case, please note that you can’t use “curly quotes” in code.

These “” must be "".

Which theme are you using? And could you provide a screenshot of what it looks like and the code you are using?

It’s not that complicated :wink:
your src-attribute lacks a starting " - and be careful to use real quotes, not the curly ones like RickCogley wrote.


I think it is a copy paste error – here is a screenshot of my code:40%20AM

The theme is Ananke.

Thanks so much for your help with this!

Thank you pkollitsch!


did not work but



I just read your messages with my brain on and it appears, that you do a simple thing wrong. The width and height attributes are integers and do contain only pixels.

Use the style attribute for percentages:

<img src="" width="500">
<img src="" style="width:10%;">

The first one shows the image with 500px width, the second one with 10%.

Hope that helps.

how to solve that problem finally?