2016-07-29 83 views
1
I need horizontal scroll bar with fixed width and right side check box. 

Currently I truncate the text, but I need horizontal scroll without truncate. 

请参阅我的示例页面在这里: - https://jsfiddle.net/gsk/hxxk53ey/22/我需要固定的宽度和右侧复选框水平滚动条

Thanks in advance. 
+0

设置'overflow-x:scroll;'到你想要的宽度的容器 –

+0

试试这个https://jsfiddle.net/hxxk53ey/23/ Hossein说 –

+0

@AB Udhay - 我没有希望个人滚动,但我需要整体水平滚动文本。 – Gsk

回答

1

我觉得这是你想要什么:

.available-box-options { 
 
    width: 500px; 
 
    font-family: Arial; 
 
    font-size: 13px; 
 
    border: solid 1px #000; 
 
    width: 500px; 
 
} 
 
.options-box { 
 
    margin-top: 11px; 
 
    margin-bottom: 11px; 
 
    margin-right: 1px; 
 
    position: relative; 
 
    overflow-x: auto; 
 
} 
 
ul.options { 
 
    margin: 0; 
 
    padding: 0; 
 
    display: inline-block; 
 
} 
 
ul li div { 
 
    display: -webkit-box; 
 
    display: -moz-box; 
 
    display: -ms-flexbox; 
 
    display: -moz-flex; 
 
    display: -webkit-flex; 
 
    display: flex; 
 
    white-space: nowrap; 
 
    -webkit-justify-content: space-between; 
 
    justify-content: space-between; 
 
} 
 

 
.selected-option-icon { 
 
    width: 20px; 
 
    height: 20px; 
 
    margin-left: 30px; 
 
}
<div class="available-box-options"> 
 
    <div class="options-box"> 
 
     <ul class="options centralScrollBar" central-scroll-event="availableItemsScroll()" style="overflow-y: auto"> 
 
      <li style="height: 30px; display: block;"> 
 
      <div style="height:30px"> 
 
       <div class="selected-option">Test > run > test > run > test > run > test > run > test > run > test > run > test > run > run > test > run</div>    
 
       <div class="selected-option-icon"> <input type="checkbox"></div> 
 
      </div> 
 
      </li> 
 
      <li style="height: 30px; display: block;"> 
 
      <div style="height:30px"> 
 
       <div class="selected-option">Test > run > test > run > test > run > test > run > test > run > test > runing</div>    
 
       <div class="selected-option-icon"> <input type="checkbox"></div> 
 
      </div> 
 
      </li> 
 
      <li style="height: 30px; display: block;"> 
 
      <div style="height:30px"> 
 
       <div class="selected-option">Test > run > test > run > test > run > test > run > test > run > test > run > test > run > run > test > run</div>    
 
       <div class="selected-option-icon"> <input type="checkbox"></div> 
 
      </div> 
 
      </li> 
 
        <li style="height: 30px; display: block;"> 
 
      <div style="height:30px"> 
 
       <div class="selected-option">Test > run > test > run > test > run > test > run > test > run > test > run > test > run > run > test > run</div>    
 
       <div class="selected-option-icon"> <input type="checkbox"></div> 
 
      </div> 
 
      </li> 
 
        <li style="height: 30px; display: block;"> 
 
      <div style="height:30px"> 
 
       <div class="selected-option">Test > run > test > run > test > run > test > run > test > run > test > run > test > run > run > test > run</div>    
 
       <div class="selected-option-icon"> <input type="checkbox"></div> 
 
      </div> 
 
      </li> 
 
      <li style="height: 30px; display: block;"> 
 
      <div style="height:30px"> 
 
       <div class="selected-option">Test > run > test > run > test > run > test > run > test > run > test > run > test > run > run > test > run</div>    
 
       <div class="selected-option-icon"> <input type="checkbox"></div> 
 
      </div> 
 
      </li> 
 
      <li style="height: 30px; display: block;"> 
 
      <div style="height:30px"> 
 
       <div class="selected-option">Test > run > test > run > test > run > test > run > test > run > test > run > test > run > run > test > run</div>    
 
       <div class="selected-option-icon"> <input type="checkbox"></div> 
 
      </div> 
 
      </li> 
 
      <li style="height: 30px; display: block;"> 
 
      <div style="height:30px"> 
 
       <div class="selected-option">Test > run > test > run > test > run > test > run > test > run > test > run</div>    
 
       <div class="selected-option-icon"> <input type="checkbox"></div> 
 
      </div> 
 
      </li>   
 
      <li style="height: 30px; display: block;"> 
 
      <div style="height:30px"> 
 
       <div class="selected-option">Test > run > test > run > test > run > test > run > test > run > test > run > test > run > run > test > run</div>    
 
       <div class="selected-option-icon"> <input type="checkbox"></div> 
 
      </div> 
 
      </li> 
 
      <li style="height: 30px; display: block;"> 
 
      <div style="height:30px"> 
 
       <div class="selected-option">Test > run > test > run > test > run > test > run > test > run > test > run > test > run > run > test > run</div>    
 
       <div class="selected-option-icon"> <input type="checkbox"></div> 
 
      </div> 
 
      </li> 
 
\t  </ul> 
 
    </div> 
 
</div>

对不起,我已经删除了一些不必要的样式es使其更具可读性

编辑: 我已经使用过Flex盒。检查新的语法

+0

很好,但复选框的位置并不好。所有的复选框应显示相同的路线。 – Gsk