【问题标题】:Show image if screen resolution is over? [closed]如果屏幕分辨率超过显示图像? [关闭]
【发布时间】:2014-01-26 14:33:04
【问题描述】:

我正在寻找一种仅在屏幕分辨率高于网页的 x,x 时才显示图像的方法。它目前仅使用 HTML/CSS 的网站,尽管我对想法持开放态度。

如果可以的话,任何帮助将不胜感激。

谢谢。

【问题讨论】:

  • 语言/环境是什么?
  • 我很抱歉。这是网页的 HTML/CSS。
  • 为此,您可能首先需要了解一下媒体查询broken-links.com/2012/07/13/…

标签: html css image


【解决方案1】:

为此,我们通常使用媒体查询

// Set Defaults for Small displays like Mobile
.img { 
    display:none; // your image class or can be img tag
} 

// Desktop and landscape tablets more than 960 px
@media (min-width: 960px){
   .img { display: block; margin: 0 auto;} // your image class or can be img tag
}

如果您有兴趣,请查看tutorial

【讨论】:

  • 谢谢,我想我现在了解媒体查询的工作原理了。
【解决方案2】:
.img
{
   display:none;
}
@media (min-width:800px) and (max-width:1200px)
{ 

 .img{display:block;}

}

您可以访问此网站了解更多信息 http://www.ibm.com/developerworks/library/wa-cssqueries/

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多