1.圆角边框
border-radius : length
原理:以length为半径的圆和边框的交集
length可以是数值,百分比
圆形:length为正方形的一半
<style>
.big {
width: 200px;
height: 200px;
background-color: yellowgreen;
border-radius: 100px;
}
</style>
<div class="big"></div>
圆角矩形:length为高的一半
<style>
.big {
width: 200px;
height: 50px;
background-color: yellowgreen;
border-radius: 25px;
}
</style>
可以给不同角设置不同弧度 boder-radius: 10px 20px 30px 40px
(数值从左上角开始按顺时针,上,右,下,左)
2.盒子阴影
box-shadow: h-shadow (水平阴影位置)| v-shadow (垂直) | blur (模糊距离) |
spread (阴影的尺寸) | color | inset (将外部阴影改为内部)
书写时按照上述顺序,水平和垂直位置必须写,默认是outset外阴影,可以不写
(下面代码中 水平位置为10px 垂直为10px 模糊距离是 2px 阴影尺寸是5px,颜色为灰色)
<!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>
.big {
width: 200px;
height: 200px;
background-color: yellowgreen;
margin: 0 auto;
box-shadow: 10px 10px 2px 5px rgba(0, 0, 0, .3);
}
</style>
</head>
<body>
<div class="big"></div>
</body>
</html>
盒子阴影不占用空间,不会影响其他盒子排列
3.文字阴影
text-shadow : h-shadow | v-shadow | blur | color
使用与盒子阴影大致相同
<!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>
h1 {
color: pink;
text-shadow: 2px 2px 1px rgba(0, 0, 0, .3);
}
</style>
</head>
<body>
<h1>文字阴影</h1>
</body>
</html>