简体   繁体   English

媒体查询最小宽度1200像素不起作用

[英]Media query min-width 1200px doesn't work

I'm trying to understand how media queries work in css . 我试图了解媒体查询如何在CSS中工作。 I'm looking for a bootstrap file and copy .container @media queries to a blank css and add colors to see it in live action: 我正在寻找一个引导文件,并将.container @media查询复制到空白CSS并添加颜色以在实际操作中查看它:

file.css: file.css:

.container {
    padding-right: 15px;
    padding-left: 15px;
    margin-right: auto;
    margin-left: auto;
    background-color:green;
}

@media (min-width: 768px) {
    .container {width: 750px;background-color:red;}
}
@media (min-width: 992px) {
     .container {width: 970px;background-color:blue;}
}
@media (min-width: 1200px ) {
    .container {width: 1170px;background-color:red;}
}

index.html 的index.html

<div class="container">Hello</div>

When i run it and resize the browser window, the div change colors but never changes to red (1200+ px). 当我运行它并调整浏览器窗口的大小时,div会更改颜色,但永远不会更改为红色(1200+像素)。

Why is this happening? 为什么会这样呢?

EDIT : 编辑:

In firefox works fine , problem apears in Chrome. 在Firefox中工作正常,在Chrome中出现问题。

You can try to look and test your webpage on 您可以尝试在以下位置查看和测试您的网页

TestSize TestSize

ScreenFly ScreenFly

Your code is working properly. 您的代码正常工作。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM