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 URL's 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 it's URL and the proper URL extention.
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.
<body>
<div class="container">
<header>
<div id="logo"></div>
<nav>
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Blog</a></li>
<li><a href="#">Services</a></li>
</ul>
</nav>
</header>
<div class="separator-top"></div>
cLorem ipsum dolor sit amet, consectetur adipisicing elit. Incidunt, atque, vitae, porro, explicabo expedita ullam tempora harum temporibus unde nam aliquam velit iste sequi aliquid et ut quo soluta fuga.
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Repellendus, ducimus, commodi, quos sunt veniam a quasi sequi nostrum delectus debitis at ad odio impedit ex minus nam tenetur voluptates excepturi?
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Esse, veritatis facilis perferendis dolorem ipsa impedit ratione. Repudiandae, quia, eligendi omnis ea aliquid nostrum rem saepe commodi asperiores molestiae magni obcaecati.</p>
<a href="#"><img src="http://copier-coller.com/wp-content/uploads/2015/01/btn.png" alt="Bouton 'en savoir plus'"></a>
<div class="clearfix"></div>
</article>
<article>
<aside>
<figure>
<img src="http://copier-coller.com/wp-content/uploads/2015/01/img1.jpg" alt="">
<img src="http://copier-coller.com/wp-content/uploads/2015/01/img2.jpg" alt="">
<img src="http://copier-coller.com/wp-content/uploads/2015/01/img3.jpg" alt="">
<img src="http://copier-coller.com/wp-content/uploads/2015/01/img4.jpg" alt="">
</figure>
<a href="#">Click to enlarge</a>
</aside>
<h1>Services offerred</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Incidunt, atque, vitae, porro, explicabo expedita ullam tempora harum temporibus unde nam aliquam velit iste sequi aliquid et ut quo soluta fuga.
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Repellendus, ducimus, commodi, quos sunt veniam a quasi sequi nostrum delectus debitis at ad odio impedit ex minus nam tenetur voluptates excepturi?
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Esse, veritatis facilis perferendis dolorem ipsa impedit ratione. Repudiandae, quia, eligendi omnis ea aliquid nostrum rem saepe commodi asperiores molestiae magni obcaecati.</p>
<a href="#"><img src="http://copier-coller.com/wp-content/uploads/2015/01/btn.png" alt="Bouton 'en savoir plus'"></a>
<div class="clearfix"></div>
</article>
<article>
<aside>
<figure>
<img src="http://copier-coller.com/wp-content/uploads/2015/01/img1.jpg" alt="">
<img src="http://copier-coller.com/wp-content/uploads/2015/01/img2.jpg" alt="">
<img src="http://copier-coller.com/wp-content/uploads/2015/01/img3.jpg" alt="">
<img src="http://copier-coller.com/wp-content/uploads/2015/01/img4.jpg" alt="">
</figure>
<a href="#">Click to enlarge</a>
</aside>
<h1>Services offerred</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Incidunt, atque, vitae, porro, explicabo expedita ullam tempora harum temporibus unde nam aliquam velit iste sequi aliquid et ut quo soluta fuga.
Lorem ipsum dolor sit amet, consec
tetur adipisicing elit. Repellendus, ducimus, commodi, quos sunt veniam a quasi sequi nostrum delectus debitis at ad odio impedit ex minus nam tenetur voluptates excepturi?
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Esse, veritatis facilis perferendis dolorem ipsa impedit ratione. Repudiandae, quia, eligendi omnis ea aliquid nostrum rem saepe commodi asperiores molestiae magni obcaecati.</p>
<a href="#"><img src="http://copier-coller.com/wp-content/uploads/2015/01/btn.png" alt="Bouton 'en savoir plus'"></a>
<div class="clearfix"></div>
</article>
<div class="pagination">
<< First 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 Last >>
</div>
<div class="separator-bottom"></div>
<footer>
<nav>
<a href="#">Home</a> |
<a href="#">About</a> |
<a href="#">Blog</a> |
<a href="#">Gallery</a>
</nav><!--
--><p class="copyright">
© Copyright © 2011.Company name all rights reserved
</p><!--
--><div class="pictos">
<a href="#" class="picto picto-facebook"></a>
<a href="#" class="picto picto-twitter"></a>
<a href="#" class="picto picto-vimeo"></a>
</div>
</footer>
</div>
</body>
</html>
body
{
background-image: url('http://copier-coller.com/wp-content/uploads/2015/01/texture.png');
text-shadow: 0 1px 0 white;
font-family: 'Rokkitt', Georgia, serif;
}
.container
{
width: 940px;
padding: 0 10px;
margin: 0 auto;
}
#logo
{
background-image: url('http://copier-coller.com/wp-content/uploads/2015/01/logo.png');
background-repeat: no-repeat;
width: 166px;
height: 49px;
float: left;
}
header
{
margin-top: 2em;
}
header > nav
{
float: right;
}
header > nav > ul {
margin: 0;
padding: 0;
}
header > nav > ul > li {
display: inline-block;
height: 49px;
line-height: 49px;
margin-left: 75px;
}
header > nav a:link,
header > nav a:visited
{
display: block;
color: #393737;
text-decoration: none;
}
header > nav a:hover,
header > nav a:active,
header > nav a:focus
{
color: #f87f12;
}
.separator-top
{
background-image: url('http://copier-coller.com/wp-content/uploads/2015/01/separator-top.png');
background-position: center center;
min-height: 58px;
clear: both;
}
.separator-bottom
{
background-image: url('http://copier-coller.com/wp-content/uploads/2015/01/separator-bottom.png');
background-position: center center;
min-height: 58px;
clear: both;
}
article
{
padding-bottom: 1em;
border-bottom: 1px solid #d4d2d2;
box-shadow: 0 1px 0 white;
}
article:last-of-type
{
border-bottom: none;
box-shadow: none;
}
article > aside
{
background-color: white;
border-radius: 5px;
width: 280px;
min-height: 290px;
float: left;
margin-right: 40px;
}
article > aside > figure
{
text-align: center;
}
article > aside > figure > img:first-child
{
padding: 10px;
}
article > aside > figure > img:not(:first-child)
{
padding: 8px;
}
article > aside > a
{
display: block;
text-align: center;
color: #cccccc;
font-weight: bold;
text-decoration: none;
font-size: 12px;
margin-bottom: 5px;
}
article > h1
{
margin: .5 0;
color: #f87f12;
font-size: 24px;
font-weight: normal;
}
article > p
{
font-size: 14px;
color: #838282;
line-height: 22px;
margin-bottom: 1.5em;
}
.pagination
{
color: #f87f12;
text-align: center;
}
footer
{
text-align: center;
font-size: 10px;
margin-bottom: 2em;
}
footer > nav,
footer > .copyright,
footer > .pictos
{
display: inline-block;
vertical-align: middle;
width: 33%;
}
footer > nav > a:link,
footer > nav > a:visited
{
color: #0d1529;
text-decoration: underline;
}
footer > .pictos
{
text-align: right;
}
footer .picto
{
margin-left: 50px;
}
.picto
{
background-image: url('http://copier-coller.com/wp-content/uploads/2015/01/pictos.png');
width: 36px;
height: 26px;
display: inline-block;
}
.picto.picto-facebook
{ background-position: 0 0; }
.picto.picto-twitter
{ background-position: -36px 0; }
.picto.picto-vimeo
{ background-position: -72px 0; }
/*! normalize.css v1.1.2 | MIT License | git.io/normalize */
/* ==========================================================================
HTML5 display definitions
========================================================================== */
/**
* Correct `block` display not defined in IE 6/7/8/9 and Firefox 3.
*/
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
main,
nav,
section,
summary {
display: block;
}
/**
* Correct `inline-block` display not defined in IE 6/7/8/9 and Firefox 3.
*/
audio,
canvas,
video {
display: inline-block;
*display: inline;
*zoom: 1;
}
/**
* Prevent modern browsers from displaying `audio` without controls.
* Remove excess height in iOS 5 devices.
*/
audio:not([controls]) {
display: none;
height: 0;
}
/**
* Address styling not present in IE 7/8/9, Firefox 3, and Safari 4.
* Known issue: no IE 6 support.
*/
[hidden] {
display: none;
}
/* ==========================================================================
Base
========================================================================== */
/**
* 1. Correct text resizing oddly in IE 6/7 when body `font-size` is set using
* `em` units.
* 2. Prevent iOS text size adjust after orientation change, without disabling
* user zoom.
*/
html {
font-size: 100%; /* 1 */
-ms-text-size-adjust: 100%; /* 2 */
-webkit-text-size-adjust: 100%; /* 2 */
}
/**
* Address `font-family` inconsistency between `textarea` and other form
* elements.
*/
html,
button,
input,
select,
textarea {
font-family: sans-serif;
}
/**
* Address margins handled incorrectly in IE 6/7.
*/
body {
margin: 0;
}
/* ==========================================================================
Links
========================================================================== */
/**
* Address `outline` inconsistency between Chrome and other browsers.
*/
a:focus {
outline: thin dotted;
}
/**
* Improve readability when focused and also mouse hovered in all browsers.
*/
a:active,
a:hover {
outline: 0;
}
/* ==========================================================================
Typography
========================================================================== */
/**
* Address font sizes and margins set differently in IE 6/7.
* Address font sizes within `section` and `article` in Firefox 4+, Safari 5,
* and Chrome.
*/
h1 {
font-size: 2em;
margin: 0.67em 0;
}
h2 {
font-size: 1.5em;
margin: 0.83em 0;
}
h3 {
font-size: 1.17em;
margin: 1em 0;
}
h4 {
font-size: 1em;
margin: 1.33em 0;
}
h5 {
font-size: 0.83em;
margin: 1.67em 0;
}
h6 {
font-size: 0.67em;
margin: 2.33em 0;
}
/**
* Address styling not present in IE 7/8/9, Safari 5, and Chrome.
*/
abbr[title] {
border-bottom: 1px dotted;
}
/**
* Address style set to `bolder` in Firefox 3+, Safari 4/5, and Chrome.
*/
b,
strong {
font-weight: bold;
}
blockquote {
margin: 1em 40px;
}
/**
* Address styling not present in Safari 5 and Chrome.
*/
dfn {
font-style: italic;
}
/**
* Address differences between Firefox and other browsers.
* Known issue: no IE 6/7 normalization.
*/
hr {
-moz-box-sizing: content-box;
box-sizing: content-box;
height: 0;
}
/**
* Address styling not present in IE 6/7/8/9.
*/
mark {
background: #ff0;
color: #000;
}
/**
* Address margins set differently in IE 6/7.
*/
p,
pre {
margin: 1em 0;
}
/**
* Correct font family set oddly in IE 6, Safari 4/5, and Chrome.
*/
code,
kbd,
pre,
samp {
font-family: monospace, serif;
_font-family: 'courier new', monospace;
font-size: 1em;
}
/**
* Improve readability of pre-formatted text in all browsers.
*/
pre {
white-space: pre;
white-space: pre-wrap;
word-wrap: break-word;
}
/**
* Address CSS quotes not supported in IE 6/7.
*/
q {
quotes: none;
}
/**
* Address `quotes` property not supported in Safari 4.
*/
q:before,
q:after {
content: '';
content: none;
}
/**
* Address inconsistent and variable font size in all browsers.
*/
small {
font-size: 80%;
}
/**
* Prevent `sub` and `sup` affecting `line-height` in all browsers.
*/
sub,
sup {
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline;
}
sup {
top: -0.5em;
}
sub {
bottom: -0.25em;
}
/* ==========================================================================
Lists
========================================================================== */
/**
* Address margins set differently in IE 6/7.
*/
dl,
menu,
ol,
ul {
margin: 1em 0;
}
dd {
margin: 0 0 0 40px;
}
/**
* Address paddings set differently in IE 6/7.
*/
menu,
ol,
ul {
padding: 0 0 0 40px;
}
/**
* Correct list images handled incorrectly in IE 7.
*/
nav ul,
nav ol {
list-style: none;
list-style-image: none;
}
/* ==========================================================================
Embedded content
========================================================================== */
/**
* 1. Remove border when inside `a` element in IE 6/7/8/9 and Firefox 3.
* 2. Improve image quality when scaled in IE 7.
*/
img {
border: 0; /* 1 */
-ms-interpolation-mode: bicubic; /* 2 */
}
/**
* Correct overflow displayed oddly in IE 9.
*/
svg:not(:root) {
overflow: hidden;
}
/* ==========================================================================
Figures
========================================================================== */
/**
* Address margin not present in IE 6/7/8/9, Safari 5, and Opera 11.
*/
figure {
margin: 0;
}
/* ==========================================================================
Forms
========================================================================== */
/**
* Correct margin displayed oddly in IE 6/7.
*/
form {
margin: 0;
}
/**
* Define consistent border, margin, and padding.
*/
fieldset {
border: 1px solid #c0c0c0;
margin: 0 2px;
padding: 0.35em 0.625em 0.75em;
}
/**
* 1. Correct color not being inherited in IE 6/7/8/9.
* 2. Correct text not wrapping in Firefox 3.
* 3. Correct alignment displayed oddly in IE 6/7.
*/
legend {
border: 0; /* 1 */
padding: 0;
white-space: normal; /* 2 */
*margin-left: -7px; /* 3 */
}
/**
* 1. Correct font size not being inherited in all browsers.
* 2. Address margins set differently in IE 6/7, Firefox 3+, Safari 5,
* and Chrome.
* 3. Improve appearance and consistency in all browsers.
*/
button,
input,
select,
textarea {
font-size: 100%; /* 1 */
margin: 0; /* 2 */
vertical-align: baseline; /* 3 */
*vertical-align: middle; /* 3 */
}
/**
* Address Firefox 3+ setting `line-height` on `input` using `!important` in
* the UA stylesheet.
*/
button,
input {
line-height: normal;
}
/**
* Address inconsistent `text-transform` inheritance for `button` and `select`.
* All other form control elements do not inherit `text-transform` values.
* Correct `button` style inheritance in Chrome, Safari 5+, and IE 6+.
* Correct `select` style inheritance in Firefox 4+ and Opera.
*/
button,
select {
text-transform: none;
}
/**
* 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio`
* and `video` controls.
* 2. Correct inability to style clickable `input` types in iOS.
* 3. Improve usability and consistency of cursor style between image-type
* `input` and others.
* 4. Remove inner spacing in IE 7 without affecting normal text inputs.
* Known issue: inner spacing remains in IE 6.
*/
button,
html input[type="button"], /* 1 */
input[type="reset"],
input[type="submit"] {
-webkit-appearance: button; /* 2 */
cursor: pointer; /* 3 */
*overflow: visible; /* 4 */
}
/**
* Re-set default cursor for disabled elements.
*/
button[disabled],
html input[disabled] {
cursor: default;
}
/**
* 1. Address box sizing set to content-box in IE 8/9.
* 2. Remove excess padding in IE 8/9.
* 3. Remove excess padding in IE 7.
* Known issue: excess padding remains in IE 6.
*/
input[type="checkbox"],
input[type="radio"] {
box-sizing: border-box; /* 1 */
padding: 0; /* 2 */
*height: 13px; /* 3 */
*width: 13px; /* 3 */
}
/**
* 1. Address `appearance` set to `searchfield` in Safari 5 and Chrome.
* 2. Address `box-sizing` set to `border-box` in Safari 5 and Chrome
* (include `-moz` to future-proof).
*/
input[type="search"] {
-webkit-appearance: textfield; /* 1 */
-moz-box-sizing: content-box;
-webkit-box-sizing: content-box; /* 2 */
box-sizing: content-box;
}
/**
* Remove inner padding and search cancel button in Safari 5 and Chrome
* on OS X.
*/
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration {
-webkit-appearance: none;
}
/**
* Remove inner padding and border in Firefox 3+.
*/
button::-moz-focus-inner,
input::-moz-focus-inner {
border: 0;
padding: 0;
}
/**
* 1. Remove default vertical scrollbar in IE 6/7/8/9.
* 2. Improve readability and alignment in all browsers.
*/
textarea {
overflow: auto; /* 1 */
vertical-align: top; /* 2 */
}
/* ==========================================================================
Tables
========================================================================== */
/**
* Remove most spacing between table cells.
*/
table {
border-collapse: collapse;
border-spacing: 0;
}
Also see: Tab Triggers