首页 > 解决方案 > 高度的功能是什么:这里的自动?

问题描述

我似乎无法确定height:auto;这里在做什么。

img {
  max-width: 100%;
  display: block;
  height: auto;
}

此代码来自以下链接:https ://www.freecodecamp.org/learn/responsive-web-design/responsive-web-design-principles/make-an-image-responsive

标签: htmlcss

解决方案


height: auto;用于让浏览器根据图像的纵横比调整图像的高度。


推荐阅读