DIV 设置四个角的border
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>DIV 设置四个角的border</title>
<style>
.chart-border-block {
position: relative;
width: 500px;
height: 500px;
/* background: #28305c; */
box-sizing: border-box;
border: 2px solid #565B77;
border-radius: 10px;
}
.chart-border-block:before {
content: '';
position: absolute;
width: 80%;
height: 100%;
bottom: -2px;
top: -2px;
left: 10%;
border-bottom: 2px solid #fff;
border-top: 2px solid #fff;
pointer-events: none;
}
.chart-border-block:after {
content: '';
position: absolute;
width: 100%;
height: 80%;
left: -2px;
right: -2px;
top: 10%;
border-left: 2px solid #fff;
border-right: 2px solid #fff;
pointer-events: none;
}
</style>
</head>
<body>
<div class="chart-border-block">
</div>
</body>
</html>
INPUT 输入框自定义
描述:去掉自己的原生样式,然后左右边框半高
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>INPUT 输入框自定义</title>
<style>
html,
body {
padding: 0;
margin: 0;
}
body {
height: calc(100vh);
display: flex;
justify-content: center;
align-items: center;
}
.container {
position: relative;
width: 400px;
height: 30px;
background: gray;
box-sizing: border-box;
border-bottom: 1px solid #333;
}
.container:before {
position: absolute;
content: "";
width: 100%;
height: 50%;
bottom: 0px;
border-left: 1px solid #333;
}
.container:after {
position: absolute;
content: "";
width: 100%;
height: 50%;
bottom: -1px;
border-right: 1px solid #333;
}
input {
width: 100%;
height: 100%;
line-height: 100%;
border: 0;
box-sizing: border-box;
padding: 0px 2px;
background: gray;
}
</style>
</head>
<body>
<div class="container">
<input type="text">
</div>
</body>
</html>