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等) 作者: 字体:[增加 减小 ...
随机推荐
- So easy Webservice 6.使用EndPoint发布webservice服务
创建第一个Web服务: @WebService // 添加了此注解,代表是一个WebService public class HelloWorld { // 非 static final privat ...
- 线程入门之yield
package com.thread; /** * <yiedl:把cpu让给其他线程> * <功能详细描述> * * @author 95Yang */ public cla ...
- Spark Streaming官方文档学习--下
Accumulators and Broadcast Variables 这些不能从checkpoint重新恢复 如果想启动检查点的时候使用这两个变量,就需要创建这写变量的懒惰的singleton实例 ...
- Spark.ML之PipeLine学习笔记
地址: http://spark.apache.org/docs/2.0.0/ml-pipeline.html Spark PipeLine 是基于DataFrames的高层的API,可以方便用户 ...
- MediaPlayer的生命周期
- 【转载】高性能IO设计 & Java NIO & 同步/异步 阻塞/非阻塞 Reactor/Proactor
开始准备看Java NIO的,这篇文章:http://xly1981.iteye.com/blog/1735862 里面提到了这篇文章 http://xmuzyq.iteye.com/blog/783 ...
- active developer path ("") does not exist
pod update --verbose --no-repo-update 出现的错误. 解决:在终端中修改你的CommandLine Tools的位置: xcode-select -switch / ...
- hibernate配置文件中的catalog属性
在hibernate表的映射文件中 <hibernate-mapping> <class name="com.sooyie.hibernate.orm.Link&qu ...
- Spring的线程池ThreadPoolTaskExecutor使用案例
1.Sping配置文件 <!-- 线程池配置 --> <bean id="threadPool" class="org.springframework. ...
- html中盒子模型立体结构图
边框(border),位于盒子的第一层..元素内容(content).内边距(padding),两者同位于第二层..背景图(background-image),位于第三层..背景色(backgroun ...