<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
<link href="https://fonts.googleapis.com/css?family=Catamaran" rel="stylesheet">
</head>
<body>
<p class="p p0"><span class="c">Ba</p>
<p class="p p1"><span class="c">Ba</p>
<p class="p p2"><span class="c">Ba</p>
</body>
</html>
*, *:after, *:before {
box-sizing: border-box;
}
body {
--color1: hsl(2,86%,58%);
--color2: hsl(0,63%,32%);
background: var(--color1);
color: var(--color2);
text-align: center;
}
.p {
background: var(--color2);
border: 2px solid white;
border-left: 0;
border-right: 0;
color: #fff;
max-width: 540px;
margin: 30px auto;
/* font metrics */
--font: Catamaran;
--fm-emSquare: 1;
--fm-capitalHeight: 0.68;
--fm-descender: 0.54;
--fm-ascender: 1.1;
--fm-linegap: 0;
/* compute needed values */
--lineheightNormal: (var(--fm-ascender) + var(--fm-descender) + var(--fm-linegap));
--distanceBottom: (var(--fm-descender));
--distanceTop: (var(--fm-ascender) - var(--fm-capitalHeight));
--contentArea: (var(--lineheightNormal) * var(--computedFontSize));
--valign: ((var(--distanceBottom) - var(--distanceTop)) * var(--computedFontSize));
--computedFontSize: (var(--capital-height) / var(--fm-capitalHeight));
--computedLineheight: ((var(--line-height) * var(--capital-height)) - var(--valign));
/* desired capital height and line-height */
--capital-height: 100;
--line-height: 1;
/* set font family */
font-family: var(--font);
/* set capital height to equal font-size */
font-size: calc(var(--computedFontSize) * 1px);
/* set computed line-height */
line-height: calc(var(--computedLineheight) * 1px);
}
.c {
/* apply vertical align */
vertical-align: calc(var(--valign) * -1px);
}
.c::before {
content: '';
display: inline-block;
width: calc(1px * var(--capital-height));
height: calc(1px * var(--capital-height));
margin-right: 10px;
background: url('https://cdn.pbrd.co/images/yBAKn5bbv.png');
background-size: cover;
}
.p1 {
--line-height: 2;
}
.p2 {
--capital-height: 75;
--line-height: 3;
}
Output
300px
You can jump to the latest bin by adding /latest
to your URL
Keyboard Shortcuts
Shortcut | Action |
---|---|
ctrl + [num] | Toggle nth panel |
ctrl + 0 | Close focused panel |
ctrl + enter | Re-render output. If console visible: run JS in console |
Ctrl + l | Clear the console |
ctrl + / | Toggle comment on selected lines |
ctrl + ] | Indents selected lines |
ctrl + [ | Unindents selected lines |
tab | Code complete & Emmet expand |
ctrl + shift + L | Beautify code in active panel |
ctrl + s | Save & lock current Bin from further changes |
ctrl + shift + s | Open the share options |
ctrl + y | Archive Bin |
Complete list of JS Bin shortcuts |
JS Bin URLs
URL | Action |
---|---|
/ | Show the full rendered output. This content will update in real time as it's updated from the /edit url. |
/edit | Edit the current bin |
/watch | Follow a Code Casting session |
/embed | Create an embeddable version of the bin |
/latest | Load the very latest bin (/latest goes in place of the revision) |
/[username]/last | View the last edited bin for this user |
/[username]/last/edit | Edit the last edited bin for this user |
/[username]/last/watch | Follow the Code Casting session for the latest bin for this user |
/quiet | Remove analytics and edit button from rendered output |
.js | Load only the JavaScript for a bin |
.css | Load only the CSS for a bin |
Except for username prefixed urls, the url may start with http://jsbin.com/abc and the url fragments can be added to the url to view it differently. |