對checkbox設(shè)置margin-right為什么距離是勾選框和文字之間的距離??而設(shè)置margin-left勾選框和文字又一起改變了距離??參照物是<p>嗎?
<style>
*{margin:0;padding:0;}
.inner{width:190px;background-color:#d5f4f5;padding:10px 20px;}
.tp{width:190px;height:30px;text-indent:20px;}
input[type="password"]{margin-top:10px;}
p{font-size:12px;margin-top:10px;overflow:hidden;}
p input{vertical-align:top;margin-right:4px;}
p a{text-decoration:none;float:right;}
input[type="button"]{width:190px;height:37px;border:0;margin-top:15px;cursor:pointer;}
#login{background:url(http://img1.sycdn.imooc.com//539a972b00013e9102280177.jpg);}
#enroll{background:url(http://img1.sycdn.imooc.com//539a972b00013e9102280177.jpg) 0 -37px;}
hr{margin-top:20px;color:#f5f5ef;}
</style>
</head>
<body>
? ? <div class="inner">
? ? ? ? <form>
? ? ? ? ? ? <input class="tp" type="text" placeholder="郵箱/手機(jī)號/用戶名" />
? ? ? ? ? ? <input class="tp"type="password" placeholder="請輸入密碼" />
? ? ? ? ? ? <p>
? ? ? ? ? ? ? ? <input type="checkbox" />下次自動登錄<a href="javascript:;">忘記密碼?</a>
? ? ? ? ? ? </p>
? ? ? ? ? ? <input id="login" type="button">
? ? ? ? ? ? <hr />
? ? ? ? ? ? <input id="enroll" type="button">
? ? ? ? </form>
? ? </div>
</body>
</html>
2015-10-14
input是行內(nèi)塊元素,一個元素設(shè)置top和left的margin值時,元素本身會偏移,而設(shè)置right和bottom的margin值時,受其影響的相鄰元素會偏移。
2015-09-18
肯定啊 ?都是內(nèi)聯(lián)元素
2015-09-18
首先p,input 標(biāo)簽 都只是 inline 元素。你給margin值本身就說不過去。