HTML preprocessors can make writing HTML more powerful or convenient. For instance, Markdown is designed to be easier to write and read for text documents and you could write a loop in Pug.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. So you don't have access to higher-up elements like the <html>
tag. If you want to add classes there that can affect the whole document, this is the place to do it.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. If you need things in the <head>
of the document, put that code here.
The resource you are linking to is using the 'http' protocol, which may not work when the browser is using https.
CSS preprocessors help make authoring CSS easier. All of them offer things like variables and mixins to provide convenient abstractions.
It's a common practice to apply CSS to a page that styles elements such that they are consistent across all browsers. We offer two of the most popular choices: normalize.css and a reset. Or, choose Neither and nothing will be applied.
To get the best cross-browser support, it is a common practice to apply vendor prefixes to CSS properties and values that require them to work. For instance -webkit-
or -moz-
.
We offer two popular choices: Autoprefixer (which processes your CSS server-side) and -prefix-free (which applies prefixes via a script, client-side).
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.
You can apply CSS to your Pen from any stylesheet on the web. Just put a URL to it here and we'll apply it, in the order you have them, before the CSS in the Pen itself.
You can also link to another Pen here (use the .css
URL Extension) and we'll pull the CSS from that Pen and include it. If it's using a matching preprocessor, use the appropriate URL Extension and we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
JavaScript preprocessors can help make authoring JavaScript easier and more convenient.
Babel includes JSX processing.
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.
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.
Using packages here is powered by Skypack, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ES6 import
usage.
All packages are different, so refer to their docs for how they work.
If you're using React / ReactDOM, make sure to turn on Babel for the JSX processing.
If active, Pens will autosave every 30 seconds after being saved once.
If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.
If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.
Visit your global Editor Settings.
<article id="docs-flex-grid">
<div class="docs-code-live inner">
<h1>Foundation 6 – Flex Grid Vertical & Horizontal Alignment </h1>
<h3 class="subheader">Examples using the new flex-box based grid system</h3>
<hr/>
<p>These examples showcase how you can use Foundation 6 to create easily customisazble layouts using the optional Flexbox Grid. This showcases the horizontal and vertical alignment options</p>
<p>
<p><strong>Note:</strong>This example uses the stylesheet taken directly off the Foundation 6 example page as of the current date of this example there isn't a direct CSS link to the optional Flex Grid layout</p>
<br/>
<h3>Flex Horizontal Alignment</h3>
<p>Shows how you can use the alignment classes to easily position your content both horizontally and vertically</p>
<b>Align right</b>
<p>Right align the elements</p>
<div class="row align-right align-container">
<div class="column small-3">Element One</div>
<div class="column small-3">Element Two</div>
<div class="column small-3">Element Three</div>
</div>
<b>Align center</b>
<p>Center align the elements
<div class="row align-center align-container">
<div class="column small-3">Element One</div>
<div class="column small-3">Element Two</div>
<div class="column small-3">Element Three</div>
</div>
<b>Align Spaced</b>
<p>Space out the elements, with even spacing around the elements</p>
<div class="row align-spaced align-container">
<div class="column small-3">Element One</div>
<div class="column small-3">Element Two</div>
<div class="column small-3">Element Three</div>
</div>
<p><a class="button" href="https://foundation.zurb.com/sites/docs/flex-grid.html#column-alignment" target="_blank">Click to view the docs about horizontal alignment</a></p>
<hr/>
<h3>Flex Verticalntal Alignment</h3>
<p>Shows how you can use the vertical alignment classes to position your content vertically. By default flex items sit at the top of their parent, but you can manually set this on an element by element basis</p>
<b>Align Top</b>
<p>Default, aligns the items to the top of the parent</p>
<div class="row align-top align-v-container">
<div class="column">Element One
<p>Here is some additional content making me taller</p>
</div>
<div class="column">Element Two</div>
<div class="column">Element Three
<p>I also have some additional content, I'm stuck to the top!</div>
</div>
<b>Align Middle</b>
<p>Aligns the items to the middle of the parent</p>
<div class="row align-middle align-v-container">
<div class="column ">Element One
<p>Here is some additional content making me taller</p>
</div>
<div class="column">Element Two</div>
<div class="column">Element Three
<p>I also have some additional content</div>
</div>
<b>Align Bottom</b>
<p>Aligns the items to the bottom of the parent</p>
<div class="row align-bottom align-v-container">
<div class="column">Element One
</div>
<div class="column">Element Two
<p>We are stuck to the bottom of the container</p>
</div>
<div class="column">Element Three
<p>I also have some additional content, I'm stuck to the top!</div>
</div>
<p>Adding the alignment classes to the parent row will make all of the items inside of it align to the chosen vertical position. You can also specify on individual elements themselves where you want them to align by specifying either align-top,
align-middle or align-bottom</p>
<p><a class="button" href="https://foundation.zurb.com/sites/docs/flex-grid.html#vertical-alignment" target="_blank">Find out more about vertical alignment on the docs</a></p>
</div>
</article>
<p class="p">Demo by Simon Codrington. <a href="http://www.sitepoint.com/foundation-6-the-new-flex-grid" target="_blank">See article</a>.</p>
body {
padding: 0 20px;
}
ul {
margin-left: 20px;
}
.button {
margin-top: 20px;
}
/* universal elements for the example */
.inner {
max-width: 1200px;
margin: auto;
padding: 20px 15px 20px 0px;
}
/* slight overrides to remove colours and styles added by an external stylesheet */
#docs-flex-grid .docs-code-live .row,
#docs-flex-grid .docs-code-live .column:nth-child(odd),
#docs-flex-grid .docs-code-live .column:nth-child(even) {
background: transparent;
border: none;
font-size: 100%;
}
/* Horizontal Flex alignment example */
.align-container {
background: #eee!important;
padding: 15px;
}
.align-container .column:nth-of-type(1) {
background: #3e9ddd!important;
}
.align-container .column:nth-of-type(2) {
background: #9b59b6!important;
}
.align-container .column:nth-of-type(3) {
background: #f39c12!important;
}
/* Vertical flex alignment example */
.align-v-container {
background: #eee!important;
padding: 15px 15px;
}
.align-v-container .column:nth-of-type(1) {
background: #34495e!important;
}
.align-v-container .column:nth-of-type(2) {
background: #16a085!important;
}
.align-v-container .column:nth-of-type(3) {
background: #7f8c8d!important;
}
/* Ordering example */
.ordering-container {
background: #eee!important;
padding: 15px 15px;
}
.p {
font-size: 14px;
text-align: center;
}
.p a {
text-decoration: underline;
}
$(document).foundation();
Also see: Tab Triggers