[英]Position elements relative to parent container
我有一个看起来像这样的幻灯片:
<div class="slideshow_cont">
<div class="slideshow_btn_cont">
</div>
<ul class="slideshow">
{% for obj in project_list %}
<li class="slide">
<img class="slideshow_thumb"/>
<span class="slideshow_thumb_label">
{{ obj.project_title }}
</span>
</li>
{% endfor %}
</ul>
</div>
.slideshow_cont{
height: 100%;
width: 100%;
display: flex;
justify-content: space-evenly;
align-items: center;
position: relative;
overflow: hidden;
}
.slideshow{
height:150px;
width:2000px;
display:flex;
justify-content: center;
align-items: center;
position:absolute;
list-style:none;
}
.slide{
width: 140px;
height: 120px;
position: relative;
margin: 0 40;
}
如何添加保证金
在第一张幻灯片和slideshow_cont
的左边框之间和
在最后一张幻灯片和slideshow_cont
的右边框之间,
使幻灯片不与按钮重叠?
谢谢
您可以使用:first-child
和:last-child
伪类来添加边距
或者在容器上使用填充
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.