CSS实现半边边框(只有边框的部分可见)

CSS实现半边边框(只有边框的部分可见)

html 复制代码
<div class="part box">
	<h1>内容</h1>
	<!-- 绘出下面两个对角边框-->
	<div class="part-footer"></div>
</div>
  • 主要代码
css 复制代码
.box {
	width: 100px;
	height: 100px;
}
.part {
	position: relative;
	&::before {
		position: absolute;
		top: 0;
		left: 0;
		content: '';
		width: 20px;
		height: 20px;
		border-left: 4px solid #4381ad;
		border-top: 4px solid #4381ad;
	}
	&::after {
		position: absolute;
		top: 0;
		right: 0;
		content: '';
		width: 20px;
		height: 20px;
		border-right: 4px solid #4381ad;
		border-top: 4px solid #4381ad;
	}
	.part-footer {
		position: absolute;
		bottom: 0;
		left: 0;
		width: 100%;
		&::before {
			position: absolute;
			bottom: 0;
			left: 0;
			content: '';
			width: 20px;
			height: 20px;
			border-left: 4px solid #4381ad;
			border-bottom: 4px solid #4381ad;
		}
		&::after {
			position: absolute;
			right: 0;
			bottom: 0;
			content: '';
			width: 20px;
			height: 20px;
			border-right: 4px solid #4381ad;
			border-bottom: 4px solid #4381ad;
		}
	}
}
相关推荐
彧翎Pro8 分钟前
基于 RO1 noetic 配置 robosense Helios 32(速腾) & xsense mti 300
前端·jvm
小码哥_常19 分钟前
解锁系统设置新姿势:Activity嵌入全解析
前端
之歆37 分钟前
前端存储方案对比:Cookie-Session-LocalStorage-IndexedDB
前端
哟哟耶耶38 分钟前
vue3-单文件组件css功能(:deep,:slotted,:global,useCssModule,v-bind)
前端·javascript·css
是罐装可乐40 分钟前
深入理解“句柄(Handle)“:从浏览器安全到文件系统访问
前端·javascript·安全
华科易迅1 小时前
Vue如何集成封装Axios
前端·javascript·vue.js
康一夏1 小时前
Next.js 13变化有多大?
前端·react·nextjs
糖炒栗子03261 小时前
前端项目标准环境搭建与启动
前端
不是az1 小时前
CSS知识点记录
前端·javascript·css
爱分享的阿Q1 小时前
GPT6-Spud-AGI前夜的豪赌
前端·easyui·agi