Reputation: 28148
Trying to use :before
on a span to add a background image off the edge of the main content.
Essentially should look like this:
I have the triangle as a bg image but can't seem to make it sit right, or show at all.
See JS Fiddle:
Upvotes: 0
Views: 125
Reputation: 1490
Here it is
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; <-
}
Upvotes: 0
Reputation: 12524
You could do this without an image at all if you wanted to
#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;
}
Here is a list of some of the other shapes you can create with css http://css-tricks.com/examples/ShapesOfCSS/
Upvotes: 2
Reputation: 19368
I got it to show up here, I think you can get the rest...
I added display: block;
and removed your background-position rule.
Upvotes: 0