具有2px宽和背景颜色的空div不显示高度为100% [英] Empty div with 2px width and background color doesnt show with height as 100%

查看:121
本文介绍了具有2px宽和背景颜色的空div不显示高度为100%的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个有3列的表,第一和第三列被垂直线分割,其中我使用100%的高度和背景颜色的表,它在FF中工作正常,但不能在Chrome或IE中工作。

I have a table with 3 columns and first and third column are divided by a vertical line for which i used table with with 100% height and background color which works in fine in FF but doesn't work in Chrome or IE.

现在我用div标签替换表,但是空div不显示。下面是示例代码我试过这么多的东西现在我困惑使用什么。需要来自CSS Gurus的帮助。

Now i replace the table with div tag but empty div doesn't show up. Below is the sample code i tried so many thing now i am confused what to use. Need help from CSS Gurus.

 .PageLine2V
    {
        width:2px;
        content: "";
        min-height: 100%;
        background-color:#D1C094;
        background-image:url('../images/gold-line-2v.gif'); 
        background-repeat:repeat-y;
    }
<table height="100%">
        <td width="60px" valign="top" align="center" >
         <div class="PageLine2V"></div>
        </td>
</table>

我不知道如何使这个空div显示和增长与表高度


I am not sure how i can make this empty div show up and grow with table height also

推荐答案

 .PageLine2V
    {
        width:2px;
        content: "";
        min-height: 100%;
        background-color:#D1C094;
        background-image:url('../images/gold-line-2v.gif'); 
        background-repeat:repeat-y;
        height: 100%;

    }

将div的高度设为100%

Give the div a height of 100%

还要在div中添加一些东西,比如没有内容就不会呈现的空格。

Also add something in the div such as a space it won't render without content.

<table height="100%">
        <td width="60px" valign="top" align="center" >
         <div class="PageLine2V">&nbsp;</div>
        </td>
</table>

这篇关于具有2px宽和背景颜色的空div不显示高度为100%的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆