css实现特殊的按钮形状-四个拐角空四边形

效果演示 

 

<div class="box">
	<div class="button">
		按钮
	</div>
</div>
<div class="box1">
	哈哈
	<span></span>
	<span></span>
	<span></span>
	<span></span>
</div>
<div class="box2">
	哈哈
	<span></span>
	<span></span>
	<span></span>
	<span></span>
</div>
.box {
	width: 100px;
	margin: 0 auto;
	margin-bottom: 20px;
}

.box .button {
	width: 100px;
	height: 40px;
	display: flex;
	align-items: center;
	justify-content: center;

	/* border: 1px solid #18324C; */
	padding: 2px;
	background: linear-gradient(to left, #fff, #fff) no-repeat left top,
				linear-gradient(to left, #fff, #fff) no-repeat right top,
				linear-gradient(to left, #fff, #fff) no-repeat left bottom,
				linear-gradient(to left, #fff, #fff) no-repeat right bottom,
				#9EE7FF;
	background-size: 8px 8px, 8px 8px, 8px 8px, 8px 8px;
}
.box1{
	position: relative;
	width: 100px;
	height: 100px;
	display: flex;
	align-items: center;
	justify-content: center;
	background-color: #006DB7;
	margin: 0 auto;
	margin-bottom: 20px;
}
.box1 span{
	display: block;
	width: 8px;
	height: 8px;
	background-color: #fff;
}
.box1 span:nth-child(1){
	position: absolute;
	top: 0;
	left: 0;
}
.box1 span:nth-child(2){
	position: absolute;
	top: 0;
	right: 0;
}
.box1 span:nth-child(3){
	position: absolute;
	bottom: 0;
	left: 0;
}
.box1 span:nth-child(4){
	position: absolute;
	bottom: 0;
	right: 0;
}
/* -------------------------- */
.box2{
	position: relative;
	width: 100px;
	height: 100px;
	display: flex;
	align-items: center;
	justify-content: center;
	background-color: #fff;
	border: 1px solid #006DB7;
	margin: 0 auto;
	margin-bottom: 20px;
}
.box2 span{
	display: block;
	width: 8px;
	height: 8px;
	background-color: #fff;
}
.box2 span:nth-child(1){
	position: absolute;
	top: -1px;
	left: -1px;
	z-index: 2;
	border-right: 1px solid #006DB7;
	border-bottom: 1px solid #006DB7;
}
.box2 span:nth-child(2){
	position: absolute;
	top: -1px;
	right: -1px;
	z-index: 2;
	border-left: 1px solid #006DB7;
	border-bottom: 1px solid #006DB7;
}
.box2 span:nth-child(3){
	position: absolute;
	bottom: -1px;
	left: -1px;
	z-index: 2;
	border-top: 1px solid #006DB7;
	border-right: 1px solid #006DB7;
}
.box2 span:nth-child(4){
	position: absolute;
	bottom: -1px;
	right: -1px;
	z-index: 2;
	border-top: 1px solid #006DB7;
	border-left: 1px solid #006DB7;
}

 使用css3属性或者自己裁切实现

posted @   JackieDYH  阅读(49)  评论(0编辑  收藏  举报  
相关博文:
阅读排行:
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 25岁的心里话
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· ollama系列01:轻松3步本地部署deepseek,普通电脑可用
· 按钮权限的设计及实现
点击右上角即可分享
微信分享提示