宽度为100%的输入重叠div

我正在尝试修复带有填充的边框在填充区域内的常规输入框。 但是,我希望输入的宽度为100%,但正如您所看到的那样,它会重叠。 我该如何解决?

CSS

#one {
    background:red;
    width:300px;
    padding:5px;
}
#two {
    width:100%;
    border:3px solid blue;
    padding:4px;
}

HTML

<div id="one"><input type="text" value="Test" id="two" /></div>​

添加box-sizing: border-box 。 否则,宽度为100% ,加上边框和填充。

链接地址: http://www.djcxy.com/p/75521.html

上一篇: Input at 100% width overlaps div

下一篇: How repeat background image in div longer then page length?