在IE中,当窗口的样式为overflow:auto时,出现滚动条的时候,内部元素的宽度不会自适应
解决方法是在样式中把内部元素的宽度用expression定义
div.parent{
width:300px;
height:500px;
overflow:auto;
}
div.sub{
width:expression(this.parentNode.offsetHeight > this.parentNode.scrollHeight ? '100%' : parseInt(this.parentNode.clientWidth) + 'px');
height:800px;
}
IE6:_height/_width 等价于 min-height/min-width
IE6:-height/-width 等价于 max-height/max-width
互联网上解决这个IE6的透明PNG的方案也是多不胜数,从使用IE特有的滤镜或是expression,再到javascript+透明GIF替代.但是这些方法都有一个缺点,就是不支持CSS中backgrond-position与background-repeat.
DD_belatedPNG支持backgrond-position与background-repeat.这是其他js插件不具备的.同时DD_belatedPNG还支持a:hover属性,以及<img>.
Read more…
以下代码将展示此问题:
<div id="container">
<div id="a"></div>
<div id="b"></div>
</div>
相关样式: Read more…
html{
background:url(fake.gif) no-repeat 0 0;/*这一行很重要,fake.gif这个文件可以随便写*/
}
body {
margin:0;
height:100%;
}
.fixed{
position:fixed;
width: 100%;
height: 35px;
line-height:35px;
background: url(images/tabcontrol.gif);
_position: absolute;/*CSS属性前加_是对IE6的hack,*/
_top:expression(eval(document.compatMode&&document.compatMode=='CSS1Compat')?documentElement.scrollTop:document.body.scrollTop);
}
Read more…
<style type="text/css" media="screen">
div.my-test {
width: 100%; height: 100px;
border: 1px solid transparent;
}
</style>
<!--[if IE 6]>
<style type="text/css" media="screen">
div.my-test {
border-color: pink;
filter: chroma(color=pink);
}
</style>
<![endif]-->
如何在CSS设置table的cellspacing,cellpadding
cellspancing 为0的时候,可以在table css属性设置 table{border-collapse:collsapse}
cellpadding值相当于td中的paddnig值 td{padding: 2px;}
语法:border-spacing : length || length
参数:length : 由浮点数字和单位标识符组成的长度值。不可为负值。请参阅长度单位
设置或检索当表格边框独立(例如当border-collapse属性等于separate时),行和单元格的边框在横向和纵向上的间距。
当只指定一个length值时,这个值将作用于横向和纵向上的间距。当指定了全部两个length值时,第一个作用于横向间距,第二个作用于纵向间距。 Read more…
写样式表有时候需要拉伸网页元素达到对预期目的,但如果拉伸的是超链接,在点击的时候出现的虚线就不是很好看了,可以通过下面的样式定义来取消点击超链接时的虚线,比基他通过javascript来解决的方法方便的多:
a{
blr:expression(this.onFocus=this.blur()); /* IE Opera */
outline:none; /* Firefox Opera */
}
a:focus{
-moz-outline-style: none; /* Firefox */
}
< !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="robots" content="all" />
<title>纯CSS的下拉菜单 支持IE6 IE7 Firefox</title>
<style type="text/css">
</style></head></html>
Read more…