Reputation: 1
I want an image to be in a triangle shape with 10px black border. I can make the shape but failing to give stroke around it. How do I do this ?
Upvotes: 0
Views: 226
Reputation: 15609
Here is a webkit only solution:
<div class="triangle">▲</div>
.triangle{
-webkit-text-stroke: 12px black;
color : transparent;
font-size:200px;
}
Here is a non-webkit solution:
<div class="new">
<div class="empty"></div>
</div>
.new {
position: relative;
width:0;
border-bottom:solid 50px black;
border-right:solid 30px transparent;
border-left:solid 30px transparent;
}
.new .empty {
position: absolute;
top:9px;
left:-21px;
width:0;
border-bottom:solid 36px white;
border-right:solid 21px transparent;
border-left:solid 21px transparent;
}
Upvotes: 1
Reputation: 9738
If you are using canvas
// stroke color
context.strokeStyle = 'blue';
context.strokeText('Hello World!', x, y);
Upvotes: 0