1.outline属性
适用于:所有元素
继承性:无
取值:outline-color \ outline-style \ outline-width
outline画在border的外面outlines相关属性不占据布局空间,不会影响元素的尺寸;
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>outline测试</title>
<style>
.container{
width:100px;
height:100px;
outline:5px solid red;
border:2px solid blue;
}
</style>
</head>
<body>
<div class="container">
注意外边框的红色轮廓
</div>
</body>
</html>
2.box-shadow属性
box-shadow: v-shadow h-shadow blur spread color inset
如果需要设置outline的圆角可以通过box-shadow间接实现,代码如下
<style>
.div{
border-radius: 1px;
box-shadow: 0 0 0 30px #cd0000;
}
</style>
上述代码box-shadow 中的30px 就是将1px的圆角扩展30px
3.user-select属性
none:文本不能被选择
text:可以选择文本
all:当所有内容作为一个整体时可以被选择。如果双击或者在上下文上点击子元素,那么被选择的部分将是以该子元素向上回溯的最高祖先元素。
element:可以选择文本,但选择范围受元素边界的约束
<style>
.test{padding:10px;-webkit-user-select:none;-moz-user-select:none;-o-user-select:none;user-select:none;background:#eee;}
</style>
</head>
<body>
<div class="test" onselectstart="return false;" unselectable="on">选择我试试,你会发现怎么也选择不到我,哈哈哈哈</div>
</body>