I'm trying to add a triangle with a star in it at the corner of an article in Joomla.
This is my code:
Html
<div class="ribbon-wrapper-featured">
<div class="ribbon-featured">
<i class="fa fa-star"></i>
</div>
</div>
Css
/*corner ribbon*/
.ribbon-wrapper-featured {
width: 50px;
height: 50px;
position: absolute;
top: 0px;
right: 0px;
}
.ribbon-featured {
width: 0;
height: 0;
border-style: solid;
border-width: 0 50px 50px 0;
border-color: transparent #f1c40f transparent transparent;
line-height: 0px;
_border-color: #000000 #f1c40f #000000 #000000;
_filter: progid:DXImageTransform.Microsoft.Chroma(color='#000000');
}
But this is what I'm getting
I'm not very good in CSS so if you have a more efficient way to achieve this, it is very welcome.
Ok, using Paulie-D's answer (Thanks!) and doing this. (Because copy-paste the answer didn't work)
HTML
CSS
Your problem is that you're trying to place a pseudo-element into a div with no height or width...so it won't fit.
If you position two pseudo-elements, the first being the Font Awesome
::before
and the second the triangle background I think you get more control.You can swap out the icon, color it how you like and you also have control of the background independent of everything else.
Something like this: