JavaScript preprocessors can help make authoring JavaScript easier and more convenient. For instance, CoffeeScript can help prevent easy-to-make mistakes and offer a cleaner syntax and Babel can bring ECMAScript 6 features to browsers that only support ECMAScript 5.

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

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

` ````
<div class="figure">
<div class="image image--16x9">
<img src="//placehold.it/1600x900" alt="">
</div>
</div>
<div class="figure">
<div class="image image--4x3">
<img src="//placehold.it/1600x1200" alt="">
</div>
</div>
<div class="figure">
<div class="image image--3x4">
<img src="//placehold.it/1200x1600" alt="">
</div>
</div>
```

` ````
@function pow($number, $exp) {
$value: 1;
@if $exp > 0 {
@for $i from 1 through $exp {
$value: $value * $number;
}
}
@else if $exp < 0 {
@for $i from 1 through -$exp {
$value: $value / $number;
}
}
@return $value;
}
@function fact($number) {
$value: 1;
@if $number > 0 {
@for $i from 1 through $number {
$value: $value * $i;
}
}
@return $value;
}
@function pi() {
@return 3.14159265359;
}
@function rad($angle) {
$unit: unit($angle);
$unitless: $angle / ($angle * 0 + 1);
// If the angle has 'deg' as unit, convert to radians.
@if $unit == deg {
$unitless: $unitless / 180 * pi();
}
@return $unitless;
}
@function sin($angle) {
$sin: 0;
$angle: rad($angle);
// Iterate a bunch of times.
@for $i from 0 through 10 {
$sin: $sin + pow(-1, $i) * pow($angle, (2 * $i + 1)) / fact(2 * $i + 1);
}
@return $sin;
}
@function cos($angle) {
$cos: 0;
$angle: rad($angle);
// Iterate a bunch of times.
@for $i from 0 through 10 {
$cos: $cos + pow(-1, $i) * pow($angle, 2 * $i) / fact(2 * $i);
}
@return $cos;
}
@function tan($angle) {
@return sin($angle) / cos($angle);
}
*, *:before, *:after {
box-sizing: border-box;
}
.figure {
width: 400px;
margin: 0 auto;
}
.image {
position: relative;
width: 100%;
height: 0;
&--16x9 {
padding-top: calc(9/16*100%);
img {
clip-path: polygon(0 #{tan(8deg) * 16 / 9 * 100%}, 100% 0, 100% #{100% - (tan(8deg) * 16 / 9 * 100%)}, 0 100%);
}
}
&--4x3 {
padding-top: calc(3/4*100%);
img {
clip-path: polygon(0 #{tan(8deg) * 4 / 3 * 100%}, 100% 0, 100% #{100% - (tan(8deg) * 4 / 3 * 100%)}, 0 100%);
}
}
&--3x4 {
padding-top: calc(4/3*100%);
img {
clip-path: polygon(0 #{tan(8deg) * 3 / 4 * 100%}, 100% 0, 100% #{100% - (tan(8deg) * 3 / 4 * 100%)}, 0 100%);
}
}
img {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: block;
width: 100%;
}
}
```

999px

Shift F
Opt F
Find & Replace

Also see: Tab Triggers