0
点赞
收藏
分享

微信扫一扫

css

其生 2022-03-30 阅读 133

W3C组织

world wide web

CSS Hack

1、ie条件注释

<!--[if IE 7]>

<![endif]-->

2、css ie7必须用<style type="text/css">

h3{color:red;}

</style>

3、if lt IE 9   小于

4、if lte IE 9  小于等于

gt 大于  gte 大于等于

!非

5、css选择符hack

*html .box{样式} ie6起作用

*+html .box{样式} 只能对ie7起作用

6、.box{_color:red} ie6起作用

    .box{*+color:red} ie以下

    .box{*color:red} 只能对ie6 ie7起作用

    .box{*color:red\0}  对ie8而生  以上也起作用  到ie11

7、 !important 只有ie6不认识 其他都认识

比行内的优先级还要高;


8、css3新增属性 写css hack 

-webkit-谷歌

-moz-火狐

-ms-ie

-o-  欧鹏

9、bug

(1)图片带来的bug

a、图片放在li中 带来3px问题  img中 display 

vertical-align:center

图片列表 <figure>

<img  />

<figcaption>

图片描述

</figcaption>

</figure>



解决方案:

bug:换行写代码,会左右的空隙

float:left;

3、 IE浏览器

给图片添加超链接之后,图片带2px紫色边框

超链接带手状态;img中  border:none/0;

4、给图片加超链接后有边框,鼠标放上去,改变边框,但是显示一半。

ie6

a{

border:1px solid red;

display:block;

width:200px;

height:200px;

}





其他:

img{

border:1px solid red;


}

img:hover{

border:1px solid red;

}

5、bug:文本和图片的对齐方式;

文本框 图像域按钮

verticl-align:middle top 



*{margin:0;padding:0;}

6、ie6浏览器产生双边距问题 有两个元素进行左浮动,给一个元素加margin-left:10px;产生20px

解决:

display:inline;



7、bug:  margin:0 auto;对ie6不起作用

解决:body{text-align:center;}

8、2个div  则取最大值  行内块级 (图片 input textarea 元素)元素特殊;这个只是针对于块级元素;



9、给子元素加margin-top时,给父元素加上了。

解决方法:给父元素加:padding:0.1px



其他带来的问题;

10、一个元素左浮动,一个元素没有浮动,这两个元素会产生3px(ie6中)

让不浮动的进行浮动;

11、其他问题

a、透明度的问题。

opacity 透明度

filter:alpha(opacity=30);  IE7|IE8

b、最小高度问题

IE浏览器   不认 min-height



c、鼠标手势不兼容

cursor:pointer手指状态 所有浏览器都认识

cursor:hand (ie浏览器)

cursor:help;

cursor:url()


12、动态伪类选择器;在ie6

中只能为a标签使用, 在其他可以给其他使用。

块级元素  加border 

border-top:2px solid transparent 



li 中用: inline-block 产生边距

border-collapse:collapse;

举报

相关推荐

0 条评论