您的位置:首页 > Web前端 > CSS

XHTML + CSS使用技巧

2011-10-31 09:35 260 查看
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> </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)浏览器下不支持了
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: