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.
You can apply a script from anywhere on the web to your Pen. Just put a URL to it here and we'll add it, in the order you have them, before the JavaScript in the Pen itself.
If the script you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the JavaScript from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
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.
<h1>Vertical center with only 3 lines of CSS</h1>
<section class="text">
<h2>Text</h2>
<p>I'm vertically aligned! Hi ho Silver, away!</p>
</section>
<section class="image">
<h2>Images</h2>
<img src="https://placeholdit.imgix.net/~text?txtsize=33&txt=120%C3%9770&w=120&h=70">
</section>
<section class="block-of-text">
<h2>Block of text</h2>
<p>
I'm a block of text!
Lorem ipsum dolor sit amet, consectetur adipisicing elit. At quia doloremque tempora placeat officia ex obcaecati tenetur deserunt repudiandae praesentium.</p>
</section>
<p class="read-more">More info at <a href="#">zerosixthree.se</a></p>
/**
* Vertical align anything with 3 lines of CSS (excluding vendor prefixes)
*
* .element {
* position: relative;
* top: 50%;
* transform: translateY(-50%);
* }
* -----------------------------------------
* Read more at: zerosixthree.se/vertical-align-anything-with-just-3-lines-of-css/
*/
.text p {
position: relative;
top: 50%;
-webkit-transform: translateY(-50%);
-ms-transform: translateY(-50%);
transform: translateY(-50%);
}
.image img {
position: relative;
top: 50%;
-webkit-transform: translateY(-50%);
-ms-transform: translateY(-50%);
transform: translateY(-50%);
}
.block-of-text p {
position: relative;
top: 50%;
-webkit-transform: translateY(-50%);
-ms-transform: translateY(-50%);
transform: translateY(-50%);
}
/* ====================================
Base styling, to make the demo more fancy
==================================== */
@import url(https://fonts.googleapis.com/css?family=Roboto:400,300,700,100);
body {
font-family: Roboto, sans-serif;
background: #2C3D51;
padding: 1em;
-webkit-font-smoothing: antialiased;
}
h1 {
text-align: center;
color: white;
font-weight: 300;
margin: 0.5em 0 1em 0;
}
h2 {
text-transform: uppercase;
margin: 0;
font-size: 16px;
position: absolute;
top: 5px;
right: 5px;
font-weight: bold;
color: #ECF0F1;
}
section {
display: block;
max-width: 500px;
background: #E74C3C;
margin: 0 auto 1em;
height: 150px;
border-radius: .2em;
position: relative;
color: white;
-webkit-transform-style: preserve-3d;
-moz-transform-style: preserve-3d;
transform-style: preserve-3d;
img, p {
display:block;
padding: 1em;
margin-left: auto;
margin-right: auto;
text-align:center;
}
}
.block-of-text {
height: 220px;
}
.read-more {
text-align: center;
color: white;
font-size: 12px;
margin-top: 3em;
a {
text-decoration: none;
color: #E74C3C;
}
}
Also see: Tab Triggers