css利用伪元素实现发票样式的边框

效果:

效果图

代码如下:

.invoice-content {
		position: relative;
		width: 622px;
		height: 148px;
		background-color: $itemSelectedBgColor;
		border: 2px dotted $mainGreenColor;
		li {
			height: 74px;
			line-height: 74px;
			font-size: 28px;
			color: $wrapperTextColor;
			.label {
				float: left;
				margin-left: 24px;
			}
			.content {
				float: right;
				max-width: 340px;
				margin-right: 24px;
				font-weight: bold;
				color: $TextColor;
			}
			i {
				color: $deleteColor;
			}
		}
	}
	.invoice-content:before {
		content: '';
		position: absolute;
		top: 58px;
		left: -16px;
		width: 32px;
		height: 32px;
		background-color: #fff;
		border-right: 2px dotted $mainGreenColor;
		border-radius: 0 50px 50px 0; // 将左上和左下角的radius设置为0以改善效果
	}
	.invoice-content:after {
		content: '';
		position: absolute;
		top: 58px;
		right: -16px;
		width: 32px;
		height: 32px;
		background-color: #fff;
		border-left: 2px dotted $mainGreenColor;
		border-radius: 50px 0 0 50px; // 将右上和右下角的radius设置为0以改善效果
	}

 实现: 利用伪类先在元素的左右两侧画一个带边框的圆,然后将左侧圆的左半部分和右侧圆的有半部分的border-radius设置为0以保证效果

ps:上述css代码是从本人代码直接copy过来,颜色及class命名问题请自动忽略

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值