Last active
August 29, 2015 14:08
-
-
Save ccwq/ac0df3d6b0884f872cbd to your computer and use it in GitHub Desktop.
html有用的但难记代码片段
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1.强制按照ie7的模式来渲染,无视doc头声明,和兼容性设置 | |
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" /> | |
2.强制按照ie当前版本来渲染,同上。 | |
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> | |
3.直接跳转 | |
<meta http-equiv="refresh" content="0;url=pathtojump"/> | |
4.禁止网页在移动设备上的缩放(非强制禁止) | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
5.媒体查询 | |
@media (max-width: 767px) | |
@media all and (min-width:xxx) and (max-width:xxx){ | |
/*这段查询的all是针对所有设备(有些设备不一定是屏幕,也许是打字机,盲人阅读器)*/ | |
} | |
@media only screen and (min-width:xxx) and (max-width:xxx){ | |
/*上面针对了所有设备,这段是只(only)针对彩色屏幕设备*/ | |
} | |
6.ie条件注释 | |
gt : greater than,选择条件版本以上版本,不包含条件版本 | |
lt : less than,选择条件版本以下版本,不包含条件版本 | |
gte : greater than or equal,选择条件版本以上版本,包含条件版本 | |
lte : less than or equal,选择条件版本以下版本,包含条件版本 | |
! : 选择条件版本以外所有版本,无论高低 | |
<!--[if (gte IE 6)&(lte IE 8)]> | |
大于等于ie6并且小于等于ie8可见(包括ie6 8) | |
<![endif]--> | |
<!--[if IE 5]>仅IE5.5可见<![endif]--> | |
<!--[if !IE 5.5]>非IE 5.5的IE可见<![endif]--> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment