Open DanielBaulig opened 1 year ago
It appears setting height: auto
in the .single .content img
selector will also resolve the issue.
It appears setting
height: auto
in the.single .content img
selector will also resolve the issue.
I'd been resizing all my images manually - only today I noticed that height
was always 2x what it should be. Then I found this post. Works perfectly, thanks!
assets/css/_custom.scss
.single .content img{
height: auto
}
Works perfectly, thanks!
Describe the bug 描述你遇到的错误
When using the
![Alt text](image_url.png)
Markdown in content in front matter leads to an incorrectly sized image for very large images. The generated CSS results in a scaled down image to be displayed, but the height of the image element itself remains the original height of the image. This appears to be because the layouts/partials/plugin/img.html plugin explicitly renders width and height attributes on the img element. If those are removed, the image scales correctly not blocking out unused whitespace along it's vertical axis.Expected behavior 期待的行为
Instead, no explicit width and height should be set on the img element, such that the CSS applied resizing (
object-fit: contain
andmax-width:100%
) can free up the vertical space.Environment 构建环境