css技巧

来源:互联网 发布:安知玉如意书包网结局 编辑:程序博客网 时间:2024/05/18 12:30
1. border-collapse:collapse;   重叠线删除
2. table-layout:fixed;word-wrap: break-word;   table中数据自动换行
3. 父: text-align:center; 子: margin-right: auto;margin-left: auto;      子div居中
4.ie6中div高度设置    默认高度为9px   因为字体默认font-size:9px;
  clear:both;
  font-size:0px;
 5. clear:both;  前加</br>
 6. 在IE6中,如果不设定父级元素的高度,则设定层高是无用的。于是修改了css,增加了下面一行:
           body{height:100%}
    将body的高度设置为撑开整个页面,问题解决。
 7.ie6下a点击高度不居中解决方法:
    .content a {
    height: 26px!import;
    height: 26px!;
    line-height: 26px;
    line-height: 26px!import;
    width: 46px;
    display: block;
    background: url(../image/music/button.png) no-repeat;
    text-align: center;
    color: #3F3D3D;
    text-decoration: none;
}
.content a:hover {
    background: url(../image/music/button2.png) no-repeat;
    text-decoration: none;
}
.content a:active {
    text-decoration: none;
    height: 26px!import;
    height: 26px!;
    line-height: 26px;
    line-height: 26px!import;
}
.content a:visited {
    text-decoration: none;
    height: 26px!import;
    height: 26px!;
    line-height: 26px;
    line-height: 26px!import;
}
8.ie6下li.hover 解决方案

page
<li><a href="javascript:void(0);" onclick="javascript:return false;">'+entry.item.cname+'</a></li>');
css
li{
   cursor: pointer;
   line-height:30px;
   height:30px;
   font-size:12px;
   width:100%;
}
li a{
    font-size:12px;
    width:100%;
    display:block;
    line-height:30px;
    height:30px;
    outline: none;
}
li a:hover{
    background-color: #E99211;
    text-decoration:none;
    color: #000;
}
li :active {
    text-decoration:none;
    star:expression(this.onFocus=this.blur());
}