Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs 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 its URL and the proper URL extension.

+ add another resource

JavaScript

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

Packages

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.

Behavior

Auto Save

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.

HTML

              
                h1 Website Calculation Tool
p
  span.en(lang="en") A calculation tool useful for web design and website creation.
p
  span.en(lang="en")
    | The metallic means and aspect ratio is calculated based on the input value entered in "Standard pixel".
    br
    | "%, vw, vh, em, rem" is calculated by inputting the standard pixel and the pixel to calculate.
h2 Numeric input
div
  | Standard pixel
  br
  input#num1(type="number" value="0" onchange="Calculation()")
div
  | Pixel to calculate
  br
  input#num2(type="number" step="0.001" value="0" onchange="Calculation()")
h2 Calculation result
div
  input#result1(type="text" value="0" readonly="readonly")
  |  %, vw, vh
div
  input#result2(type="text" value="0" readonly="readonly")
  |  em, rem
h2 Width and height calculation results
select#changeWidthHeight(onchange="changeWidthHeight()")
  option(value="w", selected="") Width
  option(value="h") Height
h3 Metallic means
div
  | Golden ratio
  input#goldenRetio(type="text" value="0" readonly="readonly")
  |  px
div
  | Silver ratio
  input#silverRetio(type="text" value="0" readonly="readonly")
  |  px
div
  | Bronze ratio
  input#bronzeRetio(type="text" value="0" readonly="readonly")
  |  px
h3 Aspect ratio
div
  span 4:3
  input#sdRetio(type="text" value="0" readonly="readonly")
  |  px
div
  span 3:2
  input#threeToTwoRetio(type="text" value="0" readonly="readonly")
  |  px
div
  | L size
  input#lSizeRetio(type="text" value="0" readonly="readonly")
  |  px
div
  span 16:9
  input#hdRetio(type="text" value="0" readonly="readonly")
  |  px
div
  span 16:10
  input#sixteenToTenRetio(type="text" value="0" readonly="readonly")
  |  px
div
  span 21:9
  input#twentyOneByNineRetio(type="text" value="0" readonly="readonly")
  |  px
div
  | OGP image
  br
  | * Please produce with a width of 1200px and a height of 630px or more.
  br
  input#ogpImageRetio(type="text" value="0" readonly="readonly")
  |  px
p
  a(href='https://www.eu-create.net/apps/web-calc/', target='_blank', rel='noopener noreferrer') Full version is here
p#copyright
  small 2019 &copy EU-Create. All rights reserved.
              
            
!

CSS

              
                $baseColor: #004d84
h1
  border-bottom: solid 3px $baseColor
h2, h3
  padding: .25em .5em
  background-color: $baseColor
  color: #fff
  border-radius: 5px

              
            
!

JS

              
                var elemChangeWidthHeight = document.getElementById('changeWidthHeight');
var elemNum1 = document.getElementById('num1');
var elemGoldenRetio = document.getElementById('goldenRetio');
var elemSilverRetio = document.getElementById('silverRetio');
var elemBronzeRetio = document.getElementById('bronzeRetio');
var elemSdRetio = document.getElementById('sdRetio');
var elemThreeToTwoRetio = document.getElementById('threeToTwoRetio');
var elemLSizeRetio = document.getElementById('lSizeRetio');
var elemHdRetio = document.getElementById('hdRetio');
var elemSixteenToTenRetio = document.getElementById('sixteenToTenRetio');
var elemTwentyOneByNineRetio = document.getElementById('twentyOneByNineRetio');
var elemOgpImageRetio = document.getElementById('ogpImageRetio');

function Calculation(){
  var num1 = parseFloat(elemNum1.value);
  var num2 = parseFloat(document.getElementById('num2').value);
  document.getElementById('result1').value = num2 / num1 * 100;
  document.getElementById('result2').value = num2 / num1;
  elemGoldenRetio.value = num1 * ((1 + Math.sqrt(5)) / 2);
  elemSilverRetio.value = num1 * Math.SQRT2;
  elemBronzeRetio.value = num1 * ((3 + Math.sqrt(13)) / 2);
  elemSdRetio.value = num1 / (3 / 4);
  elemThreeToTwoRetio.value = num1 / (3 / 2);
  elemLSizeRetio.value = num1 / (89 / 127);
  elemHdRetio.value = num1 / (9 / 16);
  elemSixteenToTenRetio.value = num1 / (5 / 8);
  elemTwentyOneByNineRetio.value = num1 / (9 / 21);
  elemOgpImageRetio.value = num1 * (120 / 63);
}

function changeWidthHeight(){
  var num1 = parseFloat(elemNum1.value);
  if (elemChangeWidthHeight.value === "h") {
    elemGoldenRetio.value = num1 / ((1 + Math.sqrt(5)) / 2);
    elemSilverRetio.value = num1 / Math.SQRT2;
    elemBronzeRetio.value = num1 / ((3 + Math.sqrt(13)) / 2);
    elemSdRetio.value = num1 * (3 / 4);
    elemThreeToTwoRetio.value = num1 * (2 / 3);
    elemLSizeRetio.value = num1 * (89 / 127);
    elemHdRetio.value = num1 * (9 / 16);
    elemSixteenToTenRetio.value = num1 * (5 / 8);
    elemTwentyOneByNineRetio.value = num1 * (9 / 21);
    elemOgpImageRetio.value = num1 / (120 / 63);
  } else {
    Calculation();
  }
}

              
            
!
999px

Console