css中border属性设置
1.单独设置
a.语法
border-witdth:像素值1,像素值2...像素值4;
border-style: 风格1,风格2,风格3,风格4;
border-color: 颜色值1,颜色值2,颜色值3,颜色值4;
b.源代码
<!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>属性值的设置</title>
<style type="text/css">
*{
padding: 0;
margin: 0;
}
#top{
width: 200px;
height: 200px;
border-width: 10px 20px 40px 30px;
border-style: solid dashed dotted solid;
border-color: brown skyblue yellow grey;
background-color: red;
}
</style>
</head>
<body>
<div id="top"></div>
</body>
</html>
c.展示效果
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/febf32289d892d5afff21a350e23939e.png)
2.合并设置
a.语法
border: 边框宽度 边框类型 边框颜色;
b.源代码
<!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>属性值的设置</title>
<style type="text/css">
*{
padding: 0;
margin: 0;
}
#top{
width: 200px;
height: 200px;
border: 10px solid skyblue;
background-color: red;
}
</style>
</head>
<body>
<div id="top"></div>
</body>
</html>
c.展示效果
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/b2ab47cb4e8d5318f3b19870c958d866.png)
3.按照方向设置
a.语法
border-方位: 边框的宽度 边框的类型 边框的颜色;
b.源代码
<!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>属性值的设置</title>
<style type="text/css">
*{
padding: 0;
margin: 0;
}
#top{
width: 200px;
height: 200px;
border-top: 10px solid gray;
border-bottom: 15px dashed brown;
border-left: 8px solid yellow;
border-right: 13px dotted purple;
background-color: red;
}
</style>
</head>
<body>
<div id="top"></div>
</body>
</html>
c.展示效果
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/18fa734d65842d09da1ce83020830a2c.png)