我有一个滑块,一次显示3个块。某些块可以有一个带有position: absolute;
的标志,并且应该显示在块之外。我最左边带有标记的块有麻烦,因为滑块容器有overflow: hidden;
,所以它被隐藏了。
这是我的布局示例。
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
.grand-parent {
position:relative;
width: 327px;
height: 200px;
margin: 50px auto;
}
.parent {
position:relative;
overflow:hidden;
width: 100%;
height: 100%;
border: 1px solid blueviolet;
}
.child {
overflow:hidden;
width: 100%;
height: 100%;
border: 1px solid red;
}
.infoblock-list-item {
position:relative;
display: inline-block;
width: 95px;
height: 100%;
border: 1px solid blue;
margin-right: 15px;
}
.infoblock-list-item:last-child {
margin-right: 0;
}
.flag {
position: absolute;
top: 3%;
left: -14px;
background: #2eaa4f;
color: #fff;
padding: 5px 10px;
font-size: 13px;
text-transform: uppercase;
}
.flag:before {
content: '';
position: absolute;
width: 0;
height: 0;
border: 7.2px solid transparent;
border-top-color: #1a8d37;
border-right-color: #1a8d37;
left: 0;
top: 100%;
}
.bx-controls-direction a{
position: absolute;
top: 50%;
margin-top: -16px;
outline: 0;
}
.bx-prev {
left: auto;
right: calc(100% + 15px);
width: 40px;
height: 40px;
transition: all 0.3s ease-out 0s;
}
.bx-next {
right: auto;
left: calc(100% + 15px);
width: 40px;
height: 40px;
transition: all 0.3s ease-out 0s;
}
<div class="grand-parent">
<div class="parent">
<div class="child">
<div class="infoblock-list-item">
<div class="flag">NEW</div>
</div>
<div class="infoblock-list-item">
</div>
<div class="infoblock-list-item">
<div class="flag">NEW</div>
</div>
</div>
</div>
<div>
<div class="bx-controls-direction">
<a class="bx-prev" href="">PREV</a>
<a class="bx-next" href="">NEXT</a>
</div>
</div>
</div>
是否存在针对我的情况的解决方案?谢谢。