css_ie6与ie8在调用float:left后margin不协调的调整

本文探讨了在IE6与IE8浏览器中出现的浮动元素margin-left双倍显示的问题及其解决方法。该问题仅发生在特定条件下,并提供了一个简单有效的解决方案。

原型:<div style="float:left;margin-left:50px; background:red;width:50px; height:50px;" ></div>

在ie6与ie8中上面代码会让margin-left出现不协调:即ie6中margin-left值是ie8中margin-left的两倍(也是常规值的两倍),

重点

这个Bug仅当浮动边界和浮动元素的方向相同时出现在浮动元素和容器盒的内边缘之间,在这之后的任意有着相似边界的浮动元素不会呈现双倍边界。只有特定的浮动行的第一个浮动元素会遭遇这个Bug。像居左的情况一样,双倍边界同样神秘地显示在居右的相同方式。

inline 默认。此元素会被显示为内联元素,元素前后没有换行符。

修改方法:添加-display:inline;

修改后:<div style="float:left;display:inline;margin-left:50px; background:red;width:50px; height:50px;" ></div>

<div class="g-box-1200 g-list-class"> <dl class="fenleinone no7"> <dt>分类:</dt> <dd> {dede:channel type=son noself=yes} <a class="swiper-slide" title="[field:typename/]" href="[field:typeurl/]">[field:typename/]</a> {/dede:channel} </dd> </dl> </div> 如何让织梦程序只在栏目id7下才调用<div class="g-box-1200 g-list-class">,其他栏目显示<div class="g-box-1200 g-list-class">; 原css格式:/* 全站全局CSS部分结束 */ *{ transition:color 100ms ease 0s, background 160ms ease 0s, border-color 160ms ease 0s;} .g-box-1200{ width:1200px; height:auto; display:block; overflow:hidden; margin:auto;} /*头部*/ .g-head-full{ width:100%; height:80px; background:#fff; display:block; overflow:hidden;} .g-head{ height:80px} .g-head .m-logo{ margin:9px 0 0 1px;} .g-head ul{ height:auto; margin:0 0 0 78px; } .g-head ul li{ height:80px; line-height:80px; font-size:18px; font-weight:normal; color:#333; float:left; margin:0 33px 0 0; display:inline; overflow:hidden} .g-head ul li a{ color:#333;} .g-head ul li a:hover{color:#ffae00} .g-head ul .f-hover a{ padding:8px 12px; background:#ffbe00; color:#fff; border-radius:5px;} .g-head ul .f-hover a:hover{ color:#fff;} .g-head form{ width:356px; height:36px; border:2px solid #ffae00; margin:22px 0 0; overflow:hidden;outline:none;position:relative;} .g-head form select{outline:none; position:absolute;padding-left:3px;height:36px; border:none; border-right:2px solid #ffae00;} .g-head form #searchType{width:278px; height:36px; line-height:36px; font-size:14px; font-weight:normal; color:#333; text-indent:38px; float:left; background:#fff; border:0; background:url(../images/jqg-index-icon.png) no-repeat 10px 10px; display:inline; overflow:hidden; outline:none;} .g-head form .m_ssbtn{ width:78px; height:36px; line-height:36px; font-size:16px; font-weight:normal; color:#fff; text-align:center; background:#ffae00; float:left; display:inline; overflow:hidden; border:0; cursor:pointer;outline:none;}
05-20
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值