【问题标题】:max-height crops an image from the bottom, how to crop it from the top?max-height 从底部裁剪图像,如何从顶部裁剪?
【发布时间】:2016-12-03 15:26:05
【问题描述】:

拥有这个 html/css 代码:

<!DOCTYPE html>
<html>
<head>    <style>
img {
max-height: 100px;
overflow: auto;
}
</style>
</head>
<body>

<img src="http://www.wwwwwww.com//photos/foto.PNG" />

</body>
</html>

我们有这个结果

像这样修改css:

img {
max-height: 75px;
overflow: auto;
}

我们有这个结果

我必须做什么才能得到这个结果?:

我找到了 clip 属性,但是我使用的是 Bootstrap 轮播,我想在这个元素上实现这个必需的方法,你知道这是否可能吗?

【问题讨论】:

    标签: html css twitter-bootstrap height carousel


    【解决方案1】:

    我不确定它是否正是您要查找的内容,但是通过将其包装在带有一些 css 属性的 &lt;div&gt; 标记中,您可以实现效果。

    我不喜欢尺寸的静态性质,所以如果您需要更动态的东西,请继续寻找,但这应该可以帮助您入门。

    https://jsfiddle.net/e9jmrkkn/25/

    【讨论】:

    • 请解释您的反对意见。我的回答(正如我所说的并不完美)提供了一个解决方案。如果您认为它不好,请提出更好的建议。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-01-08
    • 1970-01-01
    • 1970-01-01
    • 2023-04-08
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多