如何使图像从其容器的底部开始?
我在一个带有 overflow:hidden;
的短容器内有一个高图像。图像的底部被切除。如何使顶部而不是底部被切断?
I have a tall image inside a short container with overflow: hidden;
. The bottom of the image is cut off. How do I make the top get cut off instead of the bottom?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
为容器提供以下 css:
为图像提供以下 css:
PS
顺便说一句,插图非常好(而且清晰)
give the container the following css:
and the image the following css:
P.S.
Very nice (and clear) illustrations btw
如果您的图像只是容器的
background-image
,请执行以下操作:否则,将
img
元素定位到容器的底部,如 @Joseph 建议的那样:If your image is just the
background-image
of the container, do this way:Otherwise, position the
img
element to the bottom of the container, like @Joseph suggested:例如,如果容器的高度为 300px,则此方法有效:
If the container has a 300px height for example, this works: