【问题标题】:IE, DIV, images, float and LightViewIE、DIV、图像、浮动和 LightView
【发布时间】:2014-05-01 18:43:28
【问题描述】:

我正试图弄清楚为什么图像在 IE 和 Chrome 中看起来很混乱。

唉,它是一个古老的公立学校 CMS(我们说的是 00 年代早期),我当然不是程序员,而只是一个试图兼顾 CSS 和 HTML 的爱好者。

我希望我能得到一些指点。我假设它是关于浮动正确的 DIV 容器,以使其正确呈现。当我去创建覆盖文本时,整个事情都乱七八糟地爆炸了。

CSS 如下所示。 Page source can be viewed outside of the CMS frame-template here.

干杯,特林

#persongalleri
{
 margin-left:5px;
 overflow:hidden;
}
img.person /* til personalesiden */
{
    width:80px;
    height:auto;
    border:1px solid #000;
}
div.personwrap
{
    float:left;
    position:relative;
    margin:2px;
}
div.undertekstkasse
{
    position:absolute;
    bottom:1px;
    left:0px;  
    width:100%;  
    background-color:black;  
    font-family: 'Verdana, Arial, Helvetica';  
    font-size:14px;
    font-weight:bold;
    color:white;  
    opacity:0.6; 
    filter:alpha(opacity=60);
}
p.undertekst
{
    padding:6px;  
    margin:0px; 
    text-align:center;      
}

【问题讨论】:

    标签: css internet-explorer google-chrome css-float overlay


    【解决方案1】:

    它很难被发现,但所有照片的高度都略有不同,所以当你漂浮它们时,你会看到这种奇怪的行为。如果您在 .personwrap 上放置一个固定高度,那么这将解决您的布局问题。

    div.personwrap {
        height: 105px;
        margin: 2px;
        position: relative;
        float:left;
    }
    

    您也可以删除浮动,只需添加display: inline-block

    【讨论】:

    • 詹姆斯,这简直太完美了。如此“简单”的解决方案非常感谢您!
    猜你喜欢
    • 2013-08-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-11-17
    • 2013-04-03
    相关资源
    最近更新 更多