首页 > IE7父容器设置 margin-left 负值为什么会继承到子元素上面?

IE7父容器设置 margin-left 负值为什么会继承到子元素上面?

如果你觉得不需要做IE7兼容的话,请不要插嘴了,羡慕那些不用兼容IE7的伙伴们!!

<div id="vforsms">
    <input type="text" placeholder="验证码" name="verify" id="verify" class="verify" value="" />
</div>
<style>
body{position:relative;}
#vforsms{width:260px;height:auto;position:fixed;top:50%;left:50%;margin-top:-70px;margin-left:-140px;padding:10px;border: 1px solid #ccc;border-radius:0.8em;background:#ffffff;z-index:20;}
#vforsms input.verify{width:100px;margin:0 0 10px 0;display:block;}
#vforsms img.verifyImg{margin:0 0 10px 2px;cursor:pointer;width:100px;height:28px;}
#vforsms input{width:185px;height:28px;line-height:28px!important;margin:0 auto 10px;border:1px solid #ccc;background:#fff;border-radius:0.4em;padding-left:5px;vertical-align:middle;}
</style>

正常显示:

问题页面:

coding....
链接描述


首先:#vforsms input.verify{width:100px;margin:0 0 10px 0;diaplay:block;} display写错
其次 margin 不能继承的啊

给input添加
POSITION: relative; LEFT: 50%
可以得到你想要的

好像是双边距的问题
给 vforsms 添加 display:inline 能解决问题

【热门文章】
【热门文章】