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;
		}
	}
}
相关推荐
m0_748230944 分钟前
Redis 通用命令
前端·redis·bootstrap
ObjectX前端实验室2 小时前
个人网站开发记录-引流公众号 & 谷歌分析 & 谷歌广告 & GTM
前端·程序员·开源
CL_IN2 小时前
企业数据集成:实现高效调拨出库自动化
java·前端·自动化
浪九天3 小时前
Vue 不同大版本与 Node.js 版本匹配的详细参数
前端·vue.js·node.js
qianmoQ4 小时前
第五章:工程化实践 - 第三节 - Tailwind CSS 大型项目最佳实践
前端·css
椰果uu4 小时前
前端八股万文总结——JS+ES6
前端·javascript·es6
微wx笑4 小时前
chrome扩展程序如何实现国际化
前端·chrome
~废弃回忆 �༄4 小时前
CSS中伪类选择器
前端·javascript·css·css中伪类选择器
CUIYD_19894 小时前
Chrome 浏览器(版本号49之后)‌解决跨域问题
前端·chrome
IT、木易5 小时前
跟着AI学vue第五章
前端·javascript·vue.js