English 中文(简体)
差异不表示完全高
原标题:Div not showing full height
  • 时间:2011-10-25 07:33:17
  •  标签:
  • html
  • css

我有一份html档案。

<div class="ads_list_admin">
{$dlt_msg}

    {foreach  name = fe1 item = k from = $all_ads}
        <div class="ads_i_admin">

            <div class="ads_own">
                {$k->ad_owner}
            </div>
            <div class="ads_plc">
                {$k->ad_place}
            </div>
            <div class="ads_own">
                <a href="{$path_site}{$index_file}?menu=rm_ads&cmd=rmads">
                    Delete
                </a>    
            </div>
        </div>  
    {/foreach}
</div>

而四舍五入为:

.ads_list_admin
{
    width:560px;
    padding:10px 12px 10px 15px;
    background:#cdc;
}
.ads_i_admin
{
    width:540px;
    clear:both;
    margin:10px;
    color:#666666;
    font-family:Arial;
    font-size:13px;
}
.ads_own
{
    width:120px;
    float:left;
    padding:8px 6px 8px 6px;
}
.ads_plc
{
    padding:8px 6px 8px 6px;
    width:220px;
    float:left;
}

但是,我的灰心并非全部。 也就是说,四分五裂的背景并不完全显示。 这里的问题是什么?

最佳回答

you need to clear floats, easiest way is to give the parent container overflow:hidden

更好的办法是使用这种明确的固定技术,将母集装箱放在<条码>cf上。 班级:

/* For modern browsers */
.cf:before,
.cf:after {
    content:"";
    display:table;
}

.cf:after {
    clear:both;
}

/* For IE 6/7 (trigger hasLayout) */
.cf {
    zoom:1;
}
问题回答

The problem is the float: left on your inner-most divs. Floated contents are ignored when calculating an element s height.

由于所有东西都是固定的,因此试图取代<条码>float:左、<条码>、<条码>、<条码>。 这也可能是一种“科索沃”的情况,它更可取,甚至更可取,因为它认为这是一个表格数据。





相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签