你可以在css中使用FlexBox。下面的代码是
.showcase__carousel--content
将阻止向换行符添加内容。
你可以测试
dynamic nature here
.showcase__carousel--content {
display: flex;
flex-flow: row nowrap;
}
.showcase-section{
height:40vh;
text-align:center;
padding:1rem;
}
.showcase__carousel--container{
padding:1rem;
height:30rem;
width:65%;
margin-left:auto;
margin-right:auto;
}
.showcase__carousel--content{
overflow:hidden;
display: flex;
flex-flow: row nowrap;
justify-content: center;
align-items: center;
}
.showcase__carousel--item{
height:12rem;
flex: 0 0 12rem;
background-color:whitesmoke;
border-radius:5px;
box-shadow:0 0 3px rgba(0,0,0,.5);
margin:0 1rem;
display:inline-block;
}
<section class="showcase-section">
<h2 style="font-size:3rem;">Showcase</h2>
<div class="showcase__carousel--container">
<i class="fa fa-chevron-left" style="font-size:10rem; display:inline-block; float:left;"></i>
<div class="showcase__carousel--content">
<div class="showcase__carousel--item">
..
</div>
<div class="showcase__carousel--item">
..
</div>
<div class="showcase__carousel--item">
..
</div>
<div class="showcase__carousel--item">
..
</div>
<i class="fa fa-chevron-right" style="font-size:10rem; display:inline-block; float:right;"></i>
</div>
</div>
</section>