<img class="triangle" src="image.png"/>
CSS
.triangle{
??}
Now I want to apply css
to the triangle class
to show the image in a triangle.
<img class="triangle" src="image.png"/>
CSS
.triangle{
??}
Now I want to apply css
to the triangle class
to show the image in a triangle.
I've made you a fiddle here. You need to wrapp your image with a div to do what you want:
.triangle{
position: relative;
}
.triangle:before{
border-top: 0;
border-right: 190px solid white;
border-bottom: 240px solid transparent;
border-left: 170px solid white;
position: absolute;
content: "";
}
<div class='triangle'>
<img src="http://s.hswstatic.com/gif/landscape-photography-1.jpg"/>
</div>