mediaqueries最大宽度在Firefox中不起作用 [英] mediaqueries max-width not working in firefox

查看:107
本文介绍了mediaqueries最大宽度在Firefox中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用mediaquerie作为最大宽度。它适用于Chrome,但在Firefox中却没有,为什么?



jsfiddle code

CSS

  .box {
width:150px;
height:150px;
background-color:blue;
}

@media screen和(max-width:400px){
.box {
background-color:red;


$ / code $ / pre

解决方案

语法错误,你需要和(max-width)之间的空格



见下面

  @media screen and(max-width:400px){
.box {
background-color:red;
}
}

JSFIDDLE


I want to use a mediaquerie for max-width. It works fine with Chrome but in Firefox it does not, why?

jsfiddle code

CSS

.box {
    width: 150px;
    height: 150px;
    background-color: blue;
}

@media screen and(max-width: 400px){    
    .box {
        background-color: red;
    }
}

解决方案

Your syntax is wrong, you need a space between and(max-width)

See below

@media screen and (max-width: 400px){
    .box {
        background-color: red;
    }
}

JSFIDDLE

这篇关于mediaqueries最大宽度在Firefox中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆