Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我的网站上有一个 Gall-Peters 投影。我想给图像 100% 的可用宽度,同时保持高度正确,这样国家就不会被拉长。保持纵横比的正确 CSS 是什么?
img { width: 100%; height: auto; }
简直了width: 100%。应自动设置图像的高度以保持原始纵横比。
width: 100%