尝试使用:before
跨度在主要内容的边缘添加背景图像。
基本上应该是这样的:
我将三角形作为背景图像,但似乎无法使其正确放置或根本无法显示。
见 JS 小提琴:
尝试使用:before
跨度在主要内容的边缘添加背景图像。
基本上应该是这样的:
我将三角形作为背景图像,但似乎无法使其正确放置或根本无法显示。
见 JS 小提琴:
如果你愿意,你可以在没有图像的情况下做到这一点
#bottomWide span.ribbon:before {
content: "";
width: 0;
height: 0;
position: absolute;
top:0;
left: -40px;
border-top: 20px solid transparent;
border-right: 40px solid #0099ff;
border-bottom: 20px solid transparent;
}
这是您可以使用 css 创建的其他一些形状的列表 http://css-tricks.com/examples/ShapesOfCSS/
这里是
jsfiddle.net/trajce/Y6rMs/27/
#bottomWide span.ribbon{
position:relative;
background-color:#C1C976;
padding:5px 2%;
float:right;
}
#bottomWide span.ribbon:before{
content:'';
height:38px;
width:25px;
background-image:url(http://i.imgur.com/7nrYgTn.png);
background-position:center left; <-
background-repeat:no-repeat;
position:absolute;
top:0;
left:-30px; <- just play with this values a bit
height:40px; <-
width:30px; <-
}
I got it to show up here, I think you can get the rest...
I added display: block;
and removed your background-position rule.