我想创建一个轮播。
问题是overflow
在右边,而我想在左边;我尝试了right:0
,但似乎没有用;
.row {
width:300px;
}
.carousel {
max-width: 100%;
position: relative;
white-space: nowrap;
border: 1px solid red;
}
.container{
position: relative;
// overflow: hidden;
//right:0;
}
.items {
display: block;
left: 0;
position: relative;
top: 0;
}
<div class="row">
<div class="carousel">
<div class="container">
<div class="items">
<a> <img src="https://fakeimg.pl/50x50/"></a>
<a> <img src="https://fakeimg.pl/50x50/"></a>
<a> <img src="https://fakeimg.pl/50x50/"></a>
<a> <img src="https://fakeimg.pl/50x50/"></a>
<a> <img src="https://fakeimg.pl/50x50/"></a>
<a> <img src="https://fakeimg.pl/50x50/"></a>
<a> <img src="https://fakeimg.pl/50x50/"></a>
</div>
</div>
</div
</div>
答案 0 :(得分:1)
将方向更改为rtl
.row {
width: 300px;
}
.carousel {
max-width: 100%;
white-space: nowrap;
border: 1px solid red;
}
.items {
direction:rtl;
}
<div class="row">
<div class="carousel">
<div class="container">
<div class="items">
<a> <img src="https://fakeimg.pl/50x50/"></a>
<a> <img src="https://fakeimg.pl/50x50/"></a>
<a> <img src="https://fakeimg.pl/50x50/"></a>
<a> <img src="https://fakeimg.pl/50x50/"></a>
<a> <img src="https://fakeimg.pl/50x50/"></a>
<a> <img src="https://fakeimg.pl/50x50/"></a>
<a> <img src="https://fakeimg.pl/50x50/"></a>
</div>
</div>
</div>
</div>