2015-09-22 73 views
0

input-box附帶大綱,可以設置爲0。 然後它會在它周圍顯示一個醜陋的邊框。如何爲輸入框設置每邊的邊框?

此邊框也可以設置爲none,使輸入框不帶邊框。

但是我想只在輸入框的頂部和底部放一個邊框,但不能完成。 任何想法?

回答

2

應用給你的輸入元素

input { 
    border: 1px solid #000; /* this will give the input 1px black border all around */ 
    border-left: 0 none; 
    border-right: 0 none; 
} 

應該這樣做。


或者,你可以去

input { 
    border: 0; /* resets default border */ 
    border-top: [your border styling]; 
    border-bottom: [your border styling]; 
} 
+0

感謝@kevinMario!邊框樣式是否可以調整? (像像素等)似乎沒有任何工作。 – Ethannn

+0

設置border-top和border-bottom屬性。 – Sumanta736

+0

@Ehanhan更新 – kevinMario

1

只要做到這一點,如果你想使用所提供的邊境..

input { 
    border-left:0px; 
    border-right:0px; 
} 

如果你不希望不是使用。 。

input { 
    border-top:1px solid red; 
    border-bottom:1px solid red; 
    border-left:0px; 
    border-right:0px; 
}