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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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.


                <p>What you see below is a trapezoid creating by rotating a rectangle using CSS transform rules.</p>

<p>You can specify the value of each side of the trapezoid in the SCSS code and the exact transformations will be calculated and applied to generate this trapezoid.</p>



                @import 'compass/css3';

// Define the dimensions of the trapezoid below:

$side-long: 400px;
$side-short: 250px;
$side-vertical: 350px;

// This value is basically arbitrary, but to avoid edge cases that screw up the calculations it works generally better to keep it small.

$viewer-distance: 1px;

// The code below will calculate the transformations needed so that the rectangle becomes the trapezoid defined exactly by the values above.

$sin: $viewer-distance*($side-long - $side-short) / ($side-short*$side-vertical);

$angle: asin($sin);
$cos: cos($angle);
$factor: $side-vertical / ($side-vertical/2 + $viewer-distance*($side-vertical*$cos - $side-vertical/2) / ($viewer-distance + $side-vertical*$sin));

html, body {
  width: 100%;
  height: 100%;
  margin: 0;

body {
  display: flex;
  flex-direction: column;

p {
  margin: .5rem 1rem 0;
  max-width: 800px;
  text-align: left;

div {
  margin: auto;
  width: $side-long;
  height: $side-vertical;
  background-color: rgba(187, 187, 137, .25);
  position: relative;
  perspective: $viewer-distance;
  transform: scaleY($factor);
  transform-origin: bottom;

div:after {
  content: '';
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 100%;
  background-color: hsl(45, 80%, 50%);
  transform: rotateX(#{$angle}rad);
  transform-origin: bottom;