我想在图像上做一个透明的箭头.此三角形应缩进半透明块并显示背景图像.
期望的输出:

.barShow {
background-color: #000;
opacity: 0.5;
}
.barShow:before {
top: 0%;
left: 50%;
border: solid transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
border-top-color: #999;
border-width: 20px;
margin-left: -20px;
}Run Code Online (Sandbox Code Playgroud)
<div class="barShow"></div>Run Code Online (Sandbox Code Playgroud)
该透明CSS箭应该是没有颜色的透明.
尊敬的stackoverflowers,
如何使用背景图案创建三角形元素?
例如,我需要像这样的div:

但我的状态是这样的:

所有带有三角形元素的例子都使用了边框,这些边框不能使用img ....
这是我的小节课,需要colarrowrow:
<div class="subsection"><span>Ryan Gosling, Mr Landlord</span></div>
.subsection {
.box-shadow (0, -1px, 1px, 0, rgba(0, 0, 0, 0.3));
background: url('/assets/pattern-lorem.png'); // The inner part of the slider have the pattern
display: block;
clear: both;
float: left;
width: 100%;
padding-top: 15px;
padding-bottom: 15px;
display: none;
}
.subsection {
position:relative;
}
.subsection:before {
content:'';
position:absolute;
top:0;
left:0;
height:20px;
width:0;
border-left:20px solid white;
border-bottom:16px solid transparent;
}
.subsection:after {
content:'';
position:absolute;
top:36px;
left:0;
bottom:0;
width:0;
border-left:20px solid white; …Run Code Online (Sandbox Code Playgroud)