XHTML + CSS使用技巧

1、Div水平垂直居中。

.div{position:absolute;top:50%;left:50%;width:500px;height:300px; margin-top:-150px; margin-left:-250px;

border:1px #999 solid;} 

2、小下拉框箭头示例。 

<div><b>&nbsp;</b></div> 

div b{
margin: 6px 0 0 3px;
border-style: solid dashed dashed;
border-color: transparent;
border-top-color: #000;
font-size: 0;
width: 0;
height: 0;
line-height: 0; border-width: 3px 3px 0;
}

或者:

div b{

border-style:solid;
_border-style:solid dotted dotted dotted;
border-width:5px 5px 0;
display:inline-block;
border-left-color:transparent;
border-right-color:transparent;
border-left-color:transparent;
width:0; height:0;
line-height:0;
font-size:0;
overflow:hidden; 

}

3、去除a链接点击后的虚线框。

添加样式方法:outline:none; (ie不适用)

js方法(jquery):

$(document).ready(function() { 
$("a").bind("focus",function(){this.blur()}); 

}); 缺点:a:active样式在IE(6,7,8)浏览器下不支持了 

posted @ 2011-10-31 09:35  吊儿郎当  阅读(657)  评论(0编辑  收藏  举报