简体   繁体   English

@media屏幕(最小宽度:1200像素)在Chrome中不起作用

[英]@media screen (min-width:1200px) not working in Chrome

I have a problem in @media screen (min-width:1200px) . 我在@media screen (min-width:1200px)

I have set 2 kinds of attributes (classes) for an image and the in the CSS, expecting it to make the image and the "td" in which I put the image smaller when resizing the screen, but when the screen is more than 1200px still it shows the smaller size of the image. 我在CSS中为图像和设置了2种属性(类),希望在调整屏幕大小时(但当屏幕大于1200px时)使图像和“ td”(使图像变小)它仍然显示较小的图像尺寸。

This is the HTML : 这是HTML:

 <tr>
     <td class="indexphototd">
         <img class="indexphoto" src="../wp-content/uploads/2013/05/indexphoto300.jpg" /></td>
     <td>more stuff here</td> 
 </tr>

This is the CSS : 这是CSS:

/* for browsers larger than 1200px width */
@media screen (min-width: 1200px) {
     .indexphototd { 
            width:300px !important;
        }
     .indexphoto {
         width:300px !important;
      }
}


@media screen (min-width: 800px) {
     .indexphototd {
            width:200px !important;
        }
     .indexphoto {
         width:200px !important;
      }
}

Your media queries overlap: 1200px is still 800px or larger. 您的媒体查询重叠:1200px仍为800px或更大。 Simply reverse your media queries. 只需撤销您的媒体查询即可。

@media screen (min-width: 800px) {
     .indexphototd {
            width:200px !important;
        }
     .indexphoto {
         width:200px !important;
      }
}

@media screen (min-width: 1200px) {
     .indexphototd { 
            width:300px !important;
        }
     .indexphoto {
         width:300px !important;
      }
}

If a screen is say 1400px in width then the 800px will also take effect in your current setup. 如果屏幕的宽度为1400像素,那么800像素也会在您当前的设置中生效。 Swap them around like so: 像这样交换它们:

@media screen (min-width: 800px) {
     .indexphototd {
            width:200px !important;
        }
     .indexphoto {
         width:200px !important;
      }
}
@media screen (min-width: 1200px) {
     .indexphototd { 
            width:300px !important;
        }
     .indexphoto {
         width:300px !important;
      }
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 媒体查询最小宽度1200像素不起作用 - Media query min-width 1200px doesn't work 如何在wordpress上覆盖html {min-width:1200px}? - How do you override the html { min-width: 1200px } on wordpress? Bootstrap 4:防止向右移动的列(在 min-width:1200px 上使用 float)将另一列向下推 - Bootstrap 4: Prevent the column that moves to the right (using float on min-width:1200px) from pushing the other column down css 媒体查询在 1200px 大屏幕上工作 - css media query dosent work on 1200px large screen 使用Chrome Devtools,我的分辨率为1680px,但是最小宽度:1440px的媒体查询不起作用 - Using Chrome Devtools, I have the resolution @ 1680px, but a min-width:1440px media query is not working 当我在meta标签中定义content =“ max-width = 1200px;”时,媒体查询的工作方式 - How media queries are work when i define in meta tag content=“max-width=1200px;” 媒体查询(最小宽度:1800像素)在1800像素下不起作用? - media query of (min-width: 1800px) isn't working at 1800px? 为什么@media only screen and (min-width: 768px) 也适用于屏幕宽度小于768px - why @media only screen and (min-width: 768px) also apply for screen width less than 768px @media屏幕和(最小宽度)不起作用 - @media screen and (min-width) does not work @media screen and (min-width: 1280px){ 即使我的分辨率是 1920*1080 也不起作用 - @media screen and (min-width: 1280px){ does not work even though my resolution is 1920*1080
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM