目录
一、圆角边框 border-radius
1、原理及语法
radius半径原理:圆与边框的交集形成圆角的效果。
length越大,圆角越大越圆
语法:1、 border-radius:length; 如border-radius: 10px;
2、border-radius: 百分比; 如border-radius: 50px;
百分比就是高度和宽度的一半,50%就是圆形写法
2、使用效果
(1)圆形
语法: border-radius: 2/width或者50%
(2)圆角矩形 (常用)
语法:border-radius: length;
(3)不同圆角
语法:border-radius: length length length length;
length可以是数值或者百分比,这四个值分别表示左上角、右上角、右下角、左下角 。
二、盒子阴影 box-shadow
1、语法
box-shadow: h-shadow v-shadow blur spread color inset;
color一般写法:rgba(0,0,0,0.5)
注意:不可以写outset,会导致阴影无效;阴影不占用空间,不会影响排列。
2、练习-鼠标经过出现阴影的效果
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
div {
width: 200px;
height: 200px;
background-color: pink;
}
div:hover {
box-shadow: 20px 20px 10px 5px rgba(0, 0, 0, 0.3);
}
</style>
</head>
<body>
<div></div>
</body>
</html>
三、文字阴影 text-shadow
1、语法
text-shadow: h-shadow v-shadow blur color;