``````<div class="chop-this">
<img class="chop-this__art" src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/76634/cat.jpg" alt="My cat leads a very hard life; here is is moping in a cat tree." />
<div class="chop-this__triangle">
<i class="fa fa-cat"></i>
</div>
</div>``````
``````.chop-this {
// The triangle will be absolutely positioned, but we want it absolutely positioned relative to this container. Remember, absolute positioning uses the coordionates of the nearist positioned ancestor; "relative" positioning counts.
position: relative;
// The basic strategy here is to rotate a div 45 degrees and tuck it away in the corner. To get the triangle effect you will need to hide the overflow.
overflow: hidden;
}

// In order to get the image flush with all four sides, we need to display: block it. Otherwise it still behaves like the inline element it naturally is.
.chop-this__art {
display: block;
}

// We're going to move this div into position
.chop-this__triangle {
display: block;
color: #fff;

// Let's set some height / width to get a square shape. 6em seems large, but our triangle is going to be only 25% of this area…
width: 6em;
height: 6em;

// Position in the top right corner,
position: absolute;
top: 0;
right: 0;

// At this point we have a white icon over the photo but still no triangle. We will get the triangle by attaching a pseudoelement, then rotating that into position.

// Why not just add a background to this? Well, if we transform the base element, it will rotate the  background as well as everything else inside of it. Using the pseudoelement we can rotate just the shape, not the content.

&::before {
// Now in the coordinate space of .chop-this__triangle because that is positioned absolutely
background-color: #D84315;
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
content: '';
z-index: 0;

// We want to rotate around the center point, so let's set that translate origin to the middle.
transform-origin: 50% 50%;

// Now we do two transformations. The first moves the square so its center point is the top right corner of the block. The second does the rotatation.

// Always do rotation last. When you rotate something, the x and y axis rotate with it, making it much more difficult to predict position.
transform:
translate(3rem, -3rem)
rotate(45deg);
}

// Now we need to move our icon where it looks good. We can do this, too, with absolute positioning.
i {
display: block;
position: absolute;
z-index: 1;
right: .4rem;
top: .4rem;
font-size: 1.5rem;
}
}

// Ignore presentational stuff below
html {
height: calc(100% - 1em);
}

body {
height: 100%;
background-color: #10131e;
display: flex;
justify-content: center;
align-items: center;
}

.chop-this {
box-shadow: rgba(64,10,0,.5) 0 0 30px 10px
}

``````

### External JavaScript

This Pen doesn't use any external JavaScript resources.