百分比适配时的宽度问题

.caption_content {
		display: flex;
		flex-wrap: wrap;
		margin-top: 24px;
		background: #fff;
		justify-content: start;
		.caption_piece {
			width: 50%-5px;
			background-color: #d0eaff;
			margin-top: 10px;
			padding: 10px;
			box-sizing: border-box;
			&:nth-child(even) {
				margin-left: 10px;
			}
		}
}

目标效果图
在这里插入图片描述

.caption_content {
		display: flex;
		flex-wrap: wrap;
		margin-top: 24px;
		background: #fff;
		justify-content: start;
		.caption_piece {
			width: calc(50% - 5px) /*必须要空格 不然显示不正常*/;
			background-color: #d0eaff;
			margin-top: 10px;
			padding: 10px;
			box-sizing: border-box;
			&:nth-child(even) {
				margin-left: 10px;
			}
		}
}
发布了39 篇原创文章 · 获赞 5 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/YYYYYun/article/details/100112134