gpt4 book ai didi

css - 使用溢出隐藏时如何隐藏图像的左侧部分

转载 作者:搜寻专家 更新时间:2023-10-31 22:28:24 24 4
gpt4 key购买 nike

我是 CSS 编程新手。使用 overflow:hidden 隐藏大于 DIV 区域的图像。也许我希望图像的隐藏部分应该在左侧,但目前它占据了右侧。我的代码如下。

HTML代码:

<div class="a1">
<img src="img/image4.jpg">
</div>

CSS:

 .a1{height:200px;width:100px; overflow:hidden;}

最佳答案

试试这个(注意 direction: rtl;):

.a1 {
height:200px;
width:100px;
overflow:hidden;
direction: rtl;
}
<div class="a1">
<img src="http://cdn.sstatic.net/stackoverflow/img/sprites.png?v=3c6263c3453b">
</div>

关于css - 使用溢出隐藏时如何隐藏图像的左侧部分,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26990197/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com