http://jsbin.com/nuzazefuwi/1/edit?html,css,output爲什麼<input>元素不尊重最小寬度?
在上面的鏈接中,文本框應該只有10px,而不是寬度爲152px
。
這是代碼:
.input {
width: 100%;
box-sizing: border-box;
}
.cont {
padding: 2px;
}
.main {
position: absolute;
border: 1px solid black;
min-width: 15px;
}
<div class='main'>
<div class='cont'>
<input type="text" class='input' />
</div>
</div>
<br/>
<br/>
<br/> the textbox should have 10px
它看起來像輸入開始得到正確的寬度只有經過.main
min-width
比156px更大。
set'border:0;大綱:0'爲'input' – 2015-04-06 11:53:34
你想輸入字段寬度應該是10px?真的但如何? – 2015-04-06 11:59:46
在您的演示文本框中顯示100%。 – user3386779 2015-04-06 12:00:40