IE9中Media queries在iframe无效的解决方法
在css中有5个media querie
@media screen and(min-width:0px)and(max-width:319px){
body {background-color:red;}
}
@media screen and(min-width:320px)and(max-width:480px){
body {background-color:orange;}
}
@media screen and(min-width:481px)and(max-width:980px){
body {background-color:yellow;}
}
@media screen and(min-width:981px)and(max-width:1200px){
body {background-color:green;}
}
@media screen and(min-width:1201px){
body {background-color:blue;}
}
网页中包含有5个iframe,如
<iframeframeBorder="0"src="index.html"height="320"width="255"></iframe>
发现在IE9中,不包含框架的页面响应式显示正常,但有框架的页面,iframe中的内容无法实现响应式显示。
解决方法:
在主页中使用, <link href="style.css"rel="stylesheet">
在框架子页(iframe页面)中使用, <link href="style.css?frameX"rel="stylesheet">
如:
Index.html
<!DOCTYPE html>
<html lang="en">
<head>
<title>Title</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="style.css" rel="stylesheet">
</head>
<body>
<p></p>
<hr>
250px frame
<iframe frameBorder="0" src="frame1.html" height="100" width="250" id='frame_1'></iframe> <hr>
350px frame
<iframe frameBorder="0" src="frame2.html" height="100" width="350" id='frame_2'></iframe>
<hr>
390px frame
<iframe frameBorder="0" src="frame3.html" height="100" width="390" id='frame_3'></iframe>
</div>
</body>
frame1.html
<!DOCTYPE html>
<html lang="en">
<head>
<title>Title</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="style.css?page=frame1" rel="stylesheet">
</head>
<body>
<p></p>
</body>
</html>
frame2.html
<!DOCTYPE html>
<html lang="en">
<head>
<title>Title</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="style.css?page=frame2" rel="stylesheet">
</head>
<body>
<p></p>
</body>
</html>
另外的解决方法——respond.js:
respond.js是为用于IE6-8或其他不兼容Media Queries的 min/max-width属性的浏览器能够使用Media Queries的轻量级js库,其github地址为: https://github.com/scottjehl/Respond。
参考: http://stackoverflow.com/questions/10316247/media-queries-fail-inside-ie9-iframe
IE9中Media queries在iframe无效的解决方法的更多相关文章
- PHP中file_exists()判断中文文件名无效的解决方法
php中判断文件是否存在我们会使用file_exists函数或is_file函数,但在使用file_exists时如果你文件名或路径是中文在uft8编码文档时是无效.本文就来解决此问题,下面我们一起来 ...
- WPF:指定的命名连接在配置中找不到、非计划用于 EntityClient 提供程序或者无效的解决方法
文/嶽永鹏 WPF 数据绑定中绑定到ENTITY,如果把数据文件做成一个类库,在UI文件中去应用它,可能遇到下面这种情况. 指定的命名连接在配置中找不到.非计划用于 EntityClient 提供程序 ...
- js中style.display=""无效的解决方法
本文实例讲述了js中style.display=""无效的解决方法.分享给大家供大家参考.具体解决方法如下: 一.问题描述: 在js中我们有时想动态的控制一个div显示或隐藏或更多 ...
- JS网站当前日期在IE9、Chrome和FireFox中年份显示为113年的解决方法 getFullYear();
JS网站当前日期在IE9.Chrome和FireFox中年份显示为113年的解决方法 getFullYear();
- Node.js中针对中文的查找和替换无效的解决方法
Node.js中针对中文的查找和替换无效的解决方法. //tags的值: tag,测试,帖子 var pos1 = tags.indexOf("测"); //这里返回-1 ta ...
- channelartlist中autoindex无效的解决方法
{dede:channelartlist}中有使用autoindex无效的解决方法 在设计频道首页的时候,使用{dede:channelartlist}标签时,有很多朋友想做一些高级的开发,让重复的频 ...
- 设置height:100%无效的解决方法
设置height:100%无效的解决方法 刚接触网页排版的新手,常出现这种情况:设置table和div的高height="100%"无效,使用CSS来设置height:" ...
- 移动端bug~~移动端:active伪类无效的解决方法【移动端 :active样式无效】
移动端:active伪类无效的解决方法[移动端 :active样式无效]2016-09-26 15:46:50 问题: 移动端开发的时候实现按钮的点击样式变化,但是在iphone[safiri Mo ...
- PHP开发中常见的安全问题详解和解决方法(如Sql注入、CSRF、Xss、CC等
页面导航: 首页 → 网络编程 → PHP编程 → php技巧 → 正文内容 PHP安全 PHP开发中常见的安全问题详解和解决方法(如Sql注入.CSRF.Xss.CC等) 作者: 字体:[增加 减小 ...
随机推荐
- [Java解惑]应用
声明:原创作品,转载时请注明文章来自SAP师太技术博客( 博/客/园www.cnblogs.com):www.cnblogs.com/jiangzhengjun,并以超链接形式标明文章原始出处,否则将 ...
- const变量赋值报错分析
const变量赋值报错分析 const变量赋值报错 从变量到常量的赋值是合法C++的语法约定的, 如从char 到const char顺畅: 但从char **到 const char **编译器就会 ...
- DOM解析XML练习
首先以XML文件存储数据,格式如下(作为数据库) exam.xml <?xml version="1.0" encoding="UTF-8" standa ...
- .net中类型转换的案例
.net中三种数据类型转换区别((int),Int32.Parse() 和 Convert.toInt32() )(typename)valuename,是通用方法: Convert类提供了灵活的类型 ...
- iOS - Swift NSNull 空值
前言 public class NSNull : NSObject, NSCopying, NSSecureCoding 作为占据空间的一个空值,如用在数组或字典中占据一个没有任何值的空间. 1.NS ...
- hibernate.properties与hibernate.cfg.xml 区别
Hibernate的数据库连接信息是从配置文件中加载的. Hibernate的配置文件有两种形式:一种是XML格式的文件,一种是properties属性文件. 一)hibernate.cfg.xml ...
- openwrt: Makefile 框架分析
openwrt: Makefile 框架分析 原文链接:blog.chinaunix.net/uid-26675482-id-4704952.html 本篇的主要目的是想通过分析Makefile,了解 ...
- Android广播BroadcastReceiver 二
BroadcastReceiver: 在Android中,Broadcast是一种广泛运用的在应用程序之间传输信息的机制.而BroadcastReceiver是对发送出来的 Broadcast进行过滤 ...
- Android控件之AutoCompleteTextView(自动匹配输入的内容)
一.功能 动态匹配输入的内容,如百度搜索引擎当输入文本时,可以根据内容显示匹配的热门信息 二.独特属性 android:completionThreshold = "2" — ...
- Hexo+github 搭建个人博客(一)
一.软件环境准备 1.安装git windows下载exe安装:linux 执行 apt-get install git-core 安装 2.安装Node.js windows使用 msi 文件进行安 ...