2013-04-09 57 views
0

我已經在div中創建了3個輸入框,並且輸入框已經被設置爲具有269px的寬度,但是當我在瀏覽器中查看它時顯示額外的2px,我該如何阻止它。我在右邊設置了5px的邊距,但在第三個邊上設置爲0。具有額外寬度的輸入

input { 
    text-indent: 5px; 
    height: 45px; 
    color: #ffffff; 
    width: 269px; 
    margin-right: 5px; 
    background-color: #0A4E6E; 
    border: none; 
    font-family: Helvetica Neue; 
    font-size: 22px; 
    display: block; 
    float: left; 
} 
+2

請提供HTML部分。 – Arbel 2013-04-09 20:39:15

+0

當然不是DIV? – Limey 2013-04-09 20:39:55

+0

設置'input {box-sizing:border-box};'add'-moz','-webkit'如果需要 – David 2013-04-09 20:41:13

回答

2

這很可能是導致問題的邊界。嘗試使用box-sizing:border-box;使他們在瀏覽器中更加一致。

input[type=text]{ 
    -webkit-box-sizing: border-box; /* Safari/Chrome, other WebKit */ 
    -moz-box-sizing: border-box; /* Firefox, other Gecko */ 
    box-sizing: border-box;   /* Opera/IE 8+ */ 
} 
+0

Cheers buddy !!!!! – 2013-04-09 21:40:59