尊敬stackoverflowers,CSS三角形的背景图像
如何创建与背景图案的三角形元素?
例如,我需要这样的DIV:
但我的状态是这样的:
与三角形元素的所有例子都使用它不能有一个IMG的边界在那...。
这是我需要coolarrow的分部类:
<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;
border-top:16px solid transparent;
}
并即时得到:
这很好......我怎么能带来的箭头顶在需要的形式? ...并覆盖案例div? ... 谢谢。
我认为这个问题回答过类似的问题 http://stackoverflow.com/questions/11379085/make-a-css-triangle-with-transparent-background-on-a-div-with-white-bg-image?rq=1 – matthiasgh
不,它不是一个复制....需要有形状的图像,但与图像背景...不wi th从边界输入的颜色.... – SkyKOG
你会考虑使用SVG而不是CSS吗?它可能更容易。 – Spudley