IE6/IE7下只设置margin-left,左右都有边距问题

CSS代码

    div {
        border: 1px solid red;
    }
    
    .inner {
        width: 80px;
        height: 80px;
        float: left;
        position: relative;
        margin-left: 0;
    }
    
    .inner1 {
        margin-left: 20px;
    }
    
    .myDiv {
        width: 100%;
        margin: 0 auto;
    }

HTML代码

    <div class="myDiv">
        <div class="outer">
            <div class="inner inner1">1</div>
            <div class="inner">2</div>
        </div>
    </div>

JS代码

$(function() {
    window.setTimeout(function() {
        $(".myDiv").css("width", "500px");
    }, 1000)

});

 

posted @ 2015-08-26 11:44  sunhaikuo  阅读(401)  评论(0编辑  收藏  举报