首页 > 解决方案 > 在图像上设置 cut-div 的问题

问题描述

我已经cut div使用 css 从 let 和右侧创建,我想在图像上设置半个 div。但由于border-color:white切割部分不透明。我试图给出border-color:transparent但它不起作用,而是删除了切割部分......让它透明应该是什么问题?

这是我的代码:

.goldenstrip::after {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	border-bottom: 106px solid white;
	border-right: 40px solid #c1b07a;
	width: 0;
	bottom: 0;
}
.goldenstrip::before {
	content: '';
	position: absolute;
	top: 0;
	right: 0;
	border-top: 106px solid white;
	border-left: 40px solid #c1b07a;
	width: 0;
	bottom: 0;
}
.goldenstrip {
	text-align: center !important;
	display: block;
	text-transform: uppercase;
	background: #C1B07A;
	color: white;
	font-size: 24px;
	margin: 0 auto;
	padding: 38px 0px;
	position: relative;
	font-family: "Roboto Medium";z-index: 1;
  top: 52px;
  width: 90%;
}
.seminar_image img {
	width: 100%;
}
<span class="goldenstrip">Hello world</span>
<div class="seminar_image"><img src="https://stepupandlive.files.wordpress.com/2014/09/3d-animated-frog-image.jpg" alt="" class=""></div>

标签: htmlcss

解决方案


请使用这个 css 而不是你的aftercss before

goldenstrip::after {

    content: '';
    position: absolute;
    top: 0;
    left: -22px;
    width: 45px;
    bottom: 0;
    transform: skew(23deg);
    background: #c1b07a;
    }
    .goldenstrip::before {

    content: '';
    position: absolute;
    top: 0;
    right: -22px;
    width: 50px;
    bottom: 0;
    background: #c1b07a;
    transform: skew(23deg);
    }

推荐阅读