CSS的一些简单的边框练习
----只是一个小练习
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>边框练习</title>
<style>
div {
width: 100px;
height: 100px;
}
.box1 {
border: 5px solid #000000;
}
.box2 {
border-top: 5px solid red;
border-right: 5px solid gold;
border-bottom: 5px solid blueviolet;
border-left: 5px solid purple;
}
.box3 {
border: 5px solid red;
border-right: 5px dashed red;
/*CSS的层叠性*/
}
.box4 {
border: 5px solid red;
border-style: solid dashed;
}
.box5 {
border: 5px solid #000;
border-bottom: none;
/*none表示不需要的边框*/
}
.box6 {
border-width: 25px;
border-style: solid;
border-color: red purple yellowgreen blueviolet;
}
.box7 {
width: 0;
height: 0;
border-width: 250px;
border-style: solid;
border-color: red white yellowgreen white;
/*上右下左*/
border-bottom: none;
}
/*用边框做图形,此处为倒三角*/
</style>
</head>
<body>
<!-- 如果是表格可以添加 td{ border-collapse: collapse; }來合併兩個單元格之間的邊框
-->
<div class="box1"></div>
<hr>
<div class="box2"></div>
<hr>
<div class="box3"></div>
<hr>
<div class="box4"></div>
<hr>
<div class="box5"></div>
<hr>
<div class="box6"></div>
<hr>
<div class="box7"></div>
</body>
</html>