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;
		}
	}
}
相关推荐
不可能片场1 分钟前
nohup 之后进程还是死了:GUI 子进程的存活陷阱
前端·electron
名为沙丁鱼的猫7297 分钟前
React/JSX 编码规范
前端·javascript·react.js
是吕先森10 分钟前
【python】selenium实现web自动化测试
前端·python·selenium
Highcharts.js17 分钟前
甘特图纵向任务、横向时间显示图表可视化开发|Highcharts甘特图示例
开发语言·前端·javascript·可视化·甘特图·数据可视化·highcharts
yume_sibai29 分钟前
Element Plus 导航与反馈组件完全指南(15个核心组件)
前端·elementui·交互
可乐鸡翅yeah_1 小时前
hls.js 多实例并发踩坑,多视频页面播放器内存与冲突问题解决
开发语言·前端·javascript·音视频·hls·m3u8·m3u8在线播放
dsyuan0011 小时前
基于 Vue3 + ElementPlus 极简搭建仿钉钉流程设计器,简洁架构、极易扩展,纯div+css布局
css·架构·钉钉
涛涛ing1 小时前
你的页面为什么总是卡成PPT?2026年,90%的前端都忽略了主线程
前端
SoaringHeart1 小时前
Flutter 进阶 | 组件封装:用 CustomPainter 实现光环动画组件AnimatedHalo
前端·flutter
IT_陈寒1 小时前
JavaScript的隐式转换太坑了,我的==比较怎么就炸了?
前端·人工智能·后端