Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                <div class="chop-this">
	<img class="chop-this__art" src="" 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>


                .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.
			translate(3rem, -3rem)
	// 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