打破新行水平可滚动菜单排列,CSS

时间:2018-03-31 16:04:40

标签: css

我有这个菜单,显示一组颜色供用户选择......

问题

我希望在li数字23之后打破一个新的线路....

我尝试使用使用.breaker的类clear:both; display:block,但它只向下移动这个元素。

我怎么能得到这个?

.BgPickerMenu {
position: relative;
	width:300px!important;
	overflow:hidden;
    height: 80px;
	background:#fff;
	margin:50px auto 0 auto;
    border: 1px solid red;
}

.BgPickerScroll {
white-space: nowrap;
position: relative;
overflow:auto;  
font-size:0; 
border: 0px solid blue;
}

.BgPickerScroll li{
display:inline-block;
text-align:center;	
cursor:pointer;
font-size:12px;
width: 30px;
height: 30px;
border: 1px solid #E1E8ED;
}

.BgPickerScroll::-webkit-scrollbar{
  width: 0px;
  height: 0px;
  background: transparent;
}

.Breaker{
	clear:left;display:block!important;
}
<div class="BgPickerMenu">
<ul class="BgPickerScroll">
<li class="Order Color1"></li>
<li class="Order Color2"></li>
<li class="Order Color3"></li>
<li class="Order Color4"></li>
<li class="Order Color5"></li>
<li class="Order Color6"></li>
<li class="Order Color7"></li>
<li class="Order Color8"></li>
<li class="Order Color9"></li>
<li class="Order Color10"></li>
<li class="Order Color11"></li>
<li class="Order Color12"></li>
<li class="Order Color13"></li>
<li class="Order Color14"></li>
<li class="Order Color15"></li>
<li class="Order Color16"></li>
<li class="Order Color17"></li>
<li class="Order Color18"></li>
<li class="Order Color19"></li>
<li class="Order Color20"></li>
<li class="Order Color21"></li>
<li class="Order Color22"></li>
<li class="Order Color23 Breaker"></li>
<li class="Order Color24"></li>
<li class="Order Color25"></li>
<li class="Order Color26"></li>
<li class="Order Color27"></li>
<li class="Order Color28"></li>
<li class="Order Color29"></li>
<li class="Order Color30"></li>
<li class="Order Color31"></li>
</ul>

</div>

1 个答案:

答案 0 :(得分:0)

添加一些填充怎么样?

.Break {
    padding-bottom: 15px;
}