求证下,为了适应老版本的IE,这样写是否可以,是否会在别的环境出现布局问题?

阿弥陀佛 2018-12-11 10:14:17
考虑到媒体自适应的问题,我在index.html中这样写:



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh-cn">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0,user-scalable=no" />
<title>测试页面</title>
<meta name="keywords" content="测试页面"/>
<meta name="description" content="测试页面"/>


<link href="css/minstyle.css" rel="stylesheet" type="text/css" media="screen and (max-width: 640px)" />
<link href="css/style.css" rel="stylesheet" type="text/css" media="screen and (min-width: 641px)" />

<!--[if lt IE 9]>
<link href="css/style.css" rel="stylesheet" type="text/css" />
<![endif]-->

</head>




想法和思路是:
1、当宽度小于640px时(手机端),加载minstyle.css,反之(pc端)加载style.css
2、由于IE8不支持media,style.css并没有生效,所以写了如下代码:
<!--[if lt IE 9]>
<link href="css/style.css" rel="stylesheet" type="text/css" />
<![endif]-->

目前测试IE、谷歌、手机端、pc端等没问题,我想求证下高手,这种写法有没有问题,在其他情况下还会出现布局问题吗?

谢谢!
...全文
201 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
阿弥陀佛 2018-12-13
  • 打赏
  • 举报
回复
接着顶下,麻烦高手帮我看下!谢谢!
阿弥陀佛 2018-12-12
  • 打赏
  • 举报
回复
我自己顶下,望高手能看见!

61,112

社区成员

发帖
与我相关
我的任务
社区描述
层叠样式表(英文全称:Cascading Style Sheets)是一种用来表现HTML(标准通用标记语言的一个应用)或XML(标准通用标记语言的一个子集)等文件样式的计算机语言。
社区管理员
  • HTML(CSS)社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧