如何在引导缩略图类中修复特定媒体屏幕的图像大小?

时间:2016-05-26 14:59:52

标签: jquery html css twitter-bootstrap

对于bootstrap 3中的不同媒体屏幕,图像高度和宽度应该是固定的。

注意:图像位于Bootstrap的缩略图类

示例:

<div class="thumbnail>
<img />
</div> 

我把css风格写成了..

@media screen and (min-width: 970px)

{
    .thumbnail {    
        width: 291px !important;
    }

    .cardViewImage{
        height: 167px !important;
        width: 291px !important;
    }
}

@media only screen and (min-width: 1170px) 
{
    .thumbnail{
        width: 356px !important;
    }
    .cardViewImage{
        height: 204px !important;
        width: 356px !important;
    }
}

由于Bootstrap的缩略图类无法修复差异媒体屏幕的图像大小。宽度根据媒体屏幕而变化,我想在特定媒体屏幕上保持不变。

2 个答案:

答案 0 :(得分:0)

您希望图像具有固定宽度吗?

@media screen and (min-width: 970px)

{
    .thumbnail img{    
        width: 291px !important;
    }

    .cardViewImage{
        height: 167px !important;
        width: 291px !important;
    }
}

@media only screen and (min-width: 1170px) 
{
    .thumbnail img{
        width: 356px !important;
    }
    .cardViewImage{
        height: 204px !important;
        width: 356px !important;
    }
}

答案 1 :(得分:0)

请试试这个

$html = $html->find('table', 0);

希望它会有所帮助。感谢