Internet Explorer 11使用媒体查询css [英] Internet Explorer 11 using media query css

查看:224
本文介绍了Internet Explorer 11使用媒体查询css的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在IE 11上做一些测试,它使用CSS的移动设备,而不是全屏CSS。 Chrome,Firefox,Opera和Safari都使用正确的全屏CSS,但IE 11正在抓取移动/媒体CSS。我已经清除缓存多次,看看它抓住的CSS表,它是使用最新版本。

I'm doing some testing on IE 11 and it's using the CSS for mobile devices and not the "full screen" css. Chrome, Firefox, Opera and Safari all use the correct "full screen" CSS, but IE 11 is grabbing the mobile/media css. I've cleared the cache multiple times and looked at the CSS sheet that it's grabbing, and it is using the most up-to-date version.

在头部有

<!DOCTYPE html>

<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" type="text/css" href="/css/default.css">
</head>

在CSS文件中,我有以下所有的全尺寸css

In the CSS file, I have the following after all of the "full sized" css

//"full sized" css
....

@media only screen and (max-width: 479px) {
  //mobile CSS
}

IE 11在我的笔记本电脑上使用媒体CSS,我不知道为什么。我知道它只使用媒体部分,而不只是格式化不正确,因为当我从CSS中删除媒体只有部分,然后显示为预期。

IE 11 on my laptop is using the media CSS and I can't figure out why. I know it's using the media only section and not just formatting incorrectly, because when I delete the media only section from the CSS, it then displays as expected.

推荐答案

您可以尝试:

@media all and (max-width: 479px) {
  //mobile CSS
}

code>您正在定位所有设备,而不仅仅是您现在使用屏幕定位的桌面版本。

with all you are targeting all devices, and not only the desktop version you are now targeting with screen.

仅适用于移动设备:

@media (max-width: 600px) {
  //mobile CSS
}

这篇关于Internet Explorer 11使用媒体查询css的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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