Div没有对齐

时间:2013-04-07 03:59:56

标签: html css alignment

我在使用下面的CSS时遇到问题我似乎无法在品牌框旁边找到白框:

Live URL

HTML:

    <div class="homeWrapper">
            <div class="homeWrapperContentLeft">
        <div id="default">
            <div class="content_inner">
            <h1><span class="color_red">Welcome</span>/h1>
            <p>
            </p>
        </div>
        <div class="brands">
            <h1><span class="color_red">Products</span> by Brand</h1>
            <table class="manufacturer_table" height="24" style="width: 100%;" width="242">
<tbody>
<tr>
<td>
</tbody>
</table>

<div class="homeWrapperContentLeftCenter">
    text
</div>
        </div>
        </div>
        </div>  
        </div>

CSS:

.homeWrapperContentLeft{
    width:628x;
    height:825px;
    background-color: red;
}
.homeWrapperContentLeft .brands{
    float:left;
    width:251px;
    height:598px;
    padding: 12px; 
    clear: both;
}

.homeWrapperContentLeftCenter{
    float:left;
    width: 377px;
    height: 598px;
    background:#000;
}

1 个答案:

答案 0 :(得分:1)

custom.css 36 上的CSS无效:

.homeWrapperContentLeft{
    width:628x; /* should be px not x */
    height:825px;
    background-color: red;
}

32 行,您已将宽度设为66px到包装器。请将其更改为auto100%

.homeWrapper{
    padding: 12px;
    width:66px;
}

接下来的事情是,你有.homeWrapperContentLeft .brands这个float: left类有width并且你保持它的宽度很小。移除float: left;.homeWrapperContentLeft .brands{ float:left; width:251px; height:598px; padding: 12px; clear: both; }

.homeWrapperContentLeftCenter

最后,从.brand中取出{{1}}。这解决了您的问题。