简体   繁体   中英

How come there can be a margin when margin is set to 0px

See the code below:

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 -> http://jsfiddle.net/TypYn/

My problem : I do not get why there is a margin between the two inputs eventhough I did set the margin to 0px. Thank you in advance for your replies. Cheers. Marc

The problem is, HTML interprets the line break as a space. Just change your HTML to this:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM