2016-09-17 63 views
-1

之間的水平線如何添加選擇字段之間的水平線如下:如何添加選擇字段

enter image description here

請檢查相互之間的水平線:

enter image description here

+0

也許這將有助於:https://stackoverflow.com/questions/19382872/how-to-connect-html-divs-with-行 – StardustGogeta

+0

歡迎來到SO!問題通常應該更多的是「我試圖做到這一點,這是我的嘗試,這是它不工作的方式,我在哪裏出錯?」類型。 (請參閱http://stackoverflow.com/help/asking)爲了改善這個問題,請添加您的當前代碼(點擊「編輯」,然後點擊「<>」圖標,這將彈出一個窗口,輸入您的HTML和CSS然後點擊「保存並插入」並保存您的編輯) – henry

+0

發佈一些代碼,以便我們瞭解您的工作。此外,您還沒有接受任何您早期的問題,因此我建議您檢查它們,添加其他信息以便能夠正確回答,以便您可以接受它們....我們希望儘可能多地提供問題接受的答案,所以未來的用戶可以看到最適合提問的問題。 – LGSon

回答

0

你可以試試這個JSFiddle

.wrapper{ 
    position:relative; 
} 

.select2, .select1{ 
    height:20px; 
    width:40%; 
    position:absolute; 
} 

.select1{ 
    left:0; 
} 

.select2{ 
    right: 0; 
} 

.line{ 
    position:absolute; 
    border-bottom: 1px solid red; 
    top:10px; 
    left:0; 
    right:0; 
} 

線的寬度與包裝的寬度相同。

<div class="wrapper"> 
    <div class="line"> 
    </div> 
    <select class="select1"> 
    <option>1</option> 
    <option>2</option> 
    </select> 
    <select class="select2"> 
    <option>1</option> 
    <option>2</option> 
    </select> 
</div> 
1

試試這個

.line { 
 
    position: relative; 
 
    padding-left: 10px; 
 
} 
 
.line:first-child { 
 
    padding-left: 0; 
 
} 
 
.line select { 
 
    position: relative; 
 
} 
 
.line:before { 
 
    content: ""; 
 
    display: block; 
 
    position: absolute; 
 
    top: 50%; 
 
    left: 0; 
 
    width: 100%; 
 
    height: 1px; 
 
    background: red; 
 
}
<span class="line"> 
 
    <select> 
 
     <option>lorem</option> 
 
    </select> 
 
</span> 
 
<span class="line"> 
 
    <select> 
 
     <option>lorem</option> 
 
    </select> 
 
</span> 
 
<span class="line"> 
 
    <select> 
 
     <option>lorem</option> 
 
    </select> 
 
</span>

相關問題