CSS Hack大全-教你如何区分出IE6-IE10、FireFox、Chro
网络编程 2021-07-05 11:30www.168986.cn编程入门
今天把一些常用的CSS Hack整理了一下,包括常用的IE hack以及火狐、Chrome、Opera浏览器的Hack,并把这些CSS Hack综合的一起,写了一个小的浏览器测试器
现在的浏览器IE6-IE10、Firefox、Chrome、Opera、Safari。。。数量众多,可谓百家争鸣,对用户来说有了很多的可选择型,不过这可就苦了Web前端开发人员了。
今天把一些常用的CSS Hack整理了一下,包括常用的IE hack以及火狐、Chrome、Opera浏览器的Hack,并把这些CSS Hack综合的一起,写了一个小的浏览器测试器。如图所示:
狼蚁网站SEO优化就来看一下代码吧:
html部分:
代码如下:
<div class="content">
<div class="test"></div>
<div class="txt">
<p>IE6下背景颜色:<span class="ie6" style="background-color: #c;">#c</span></p>
<p>IE7下背景颜色:<span class="ie7" style="background-color: #666;">#666</span></p>
<p>IE8下背景颜色:<span class="ie8" style="background-color: #06f;">#06f</span></p>
<p>IE9下背景颜色:<span class="ie9" style="background-color: #f00;">#f00</span></p>
<p>IE10下背景颜色:<span class="ie10" style="background-color: #0ff;">#0ff</span></p>
<p>webkit,Safari,Chrome下背景颜色:<span class="webkit-safari-gg" style="background-color: #ff0;">#ff0</span></p>
<p>FireFox下背景颜色:<span class="firefox" style="background-color: #f0f;">#f0f</span></p>
<p>Opera下背景颜色:<span class="opera" style="background-color: #0f0;">#0f0</span></p>
</div>
</div>
CSS部分,此部分就只贴Hack部分的代码吧,布局的就不贴了:
代码如下:
.content .test {
width: 200px;
height: 200px;
background: #f60; /*all*/
background: #06f9; /*IE*/
*background: #666; /*IE6,7*/
_background: #c; /*IE6*/
}
/* webkit and opera */
@media all and (min-width:0){
.content .test {
background: #0f0;
}
}
/* webkit */
@media screen and (-webkit-min-device-pixel-ratio:0) {
.content .test {
background: #ff0;
}
}
/*FireFox*/
@-moz-document url-prefix() {
.content .test {
background: #f0f;
}
}
/*IE9+*/
@media all and (min-width:0) {
.content .test{
background: #f009;
}
}
/*IE10+*/
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
.content .test {
background: #0ff;
}
}
编程语言
- 机械手焊接机器人编程 机械手焊接设备编程
- vb数据库编程实例,vb做数据库
- tiobe世界编程语言排行榜,全球编程语言排行
- 成都java编程培训 成都it编程培训中心
- 编程基础培训,编程基础知识培训
- flash游戏编程基础教程,flash游戏开发教程
- 不会英语能学编程吗 不会英语可以学程序员吗
- 爱心代码编程C语言 爱心代码编程c语言公式
- c语言编程学习入门 c语言编程快速入门
- 西门子plc编程培训 西门子plc编程培训班
- 哪里可以学编程 台州哪里可以学编程
- 少儿编程哪个好 少儿编程哪个品牌好
- 编程是什么意思,图形编程是什么意思
- c语言编程软件下载,c语言编程软件在哪下载
- java编程软件下载,java编程下载手机版
- ug编程培训学校,ug编程培训教程