当保证金设置为0px时,怎么会有保证金

时间:2012-11-23 21:09:10

标签: css margin

请参阅以下代码:

HTML

<input class="input-form" type="text">
<input class="input-form" type="password">
       ​

CSS

.input-form{
    width:250px;
    height:30px;
    border: 2px solid red;
    margin:0px;
}

JSFIddle - &gt; http://jsfiddle.net/TypYn/

我的问题:我不明白为什么两个输入之间有一个余量,尽管我确实将余量设置为0px。提前感谢您的回复。干杯。马克

1 个答案:

答案 0 :(得分:6)

问题是,HTML将换行符解释为空格。只需将您的HTML更改为:

<input class="input-form" type="text"><input class="input-form" type="password">