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 esm.sh, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ESM 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.
header.diagonal
h1 Post Title
.container
h3 Section Header
p Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec odio. Quisque volutpat mattis eros. Nullam malesuada erat ut turpis. Suspendisse urna nibh, viverra non, semper suscipit, posuere a, pede.
blockquote The public is more familiar with bad design than good design. It is, in effect, conditioned to prefer bad design, because that is what it lives with. The new becomes threatening, the old reassuring.
cite ~ Paul Rand
p Donec nec justo eget felis facilisis fermentum. Aliquam porttitor mauris sit amet orci. Aenean dignissim pellentesque felis. Morbi in sem quis dui placerat ornare. Pellentesque odio nisi, euismod in, pharetra a, ultricies in, diam. Sed arcu. Cras consequat.
h3 Section Header
p Praesent dapibus, neque id cursus faucibus, tortor neque egestas auguae, eu vulputate magna eros eu erat. Aliquam erat volutpat. Nam dui mi, tincidunt quis, accumsan porttitor, facilisis luctus, metus.
p Phasellus ultrices nulla quis nibh. Quisque a lectus. Donec consectetuer ligula vulputate sem tristique cursus. Nam nulla quam, gravida non, commodo a, sodales sit amet, nisi.
h3 Section Header
p Donec nec justo eget felis facilisis fermentum. Aliquam porttitor mauris sit amet orci. Aenean dignissim pellentesque felis. Morbi in sem quis dui placerat ornare. Pellentesque odio nisi, euismod in, pharetra a, ultricies in, diam. Sed arcu. Cras consequat.
p Praesent dapibus, neque id cursus faucibus, tortor neque egestas auguae, eu vulputate magna eros eu erat. Aliquam erat volutpat. Nam dui mi, tincidunt quis, accumsan porttitor, facilisis luctus, metus.
p Phasellus ultrices nulla quis nibh. Quisque a lectus. Donec consectetuer ligula vulputate sem tristique cursus. Nam nulla quam, gravida non, commodo a, sodales sit amet, nisi.
// Color Variables
$background: #fff
$color: #00CC8F
// Basic Page CSS
body, html
background: $background
color: #333
font-size: 20px
line-height: 1.8em
margin: 0
overflow-x: hidden
padding: 0
h1, h2, h3, h4, h5, h6
color: #1a1a1a
line-height: 1.2em
margin: 2.1em 0 0.7em
h1
font-size: 2em
h2
font-size: 1.8em
h3
font-size: 1.6em
h4
font-size: 1.4em
h5
font-size: 1.2em
h6
font-size: 1em
a
color: #00B881
.container
max-width: 960px
padding: 0 6em 3em
// Featured Image CSS
.diagonal
position: relative
width: 100%
background: url("https://unsplash.it/1920/1080?image=901") no-repeat
background-attachment: fixed
background-size: cover
color: $background
display: flex
height: 52vh
justify-content: center
&:before
content: ''
position: absolute
top: 0
right: 0
bottom: 0
left: 0
background: rgba(0, 0, 0, 0.5)
&:after
content: ''
position: absolute
right: -10px
bottom: -1px
border-left-color: $background
border-left-style: solid
border-left-width: calc(100vw + 10px)
border-top: 12vw solid transparent
h1
color: $background
display: flex
position: relative
justify-content: center
align-items: center
height: 100%
margin-top: -1em
// Blockquote CSS
blockquote
border-left: 3px solid $color
color: #1a1a1a
font-family: Georgia, Times, "Times New Roman", serif
font-size: 1.25em
font-style: italic
line-height: 1.8em
margin: 1.1em -4em
padding: 1em 2em
position: relative
transition: .2s border ease-in-out
z-index: 0
&:before
content: ""
position: absolute
top: 50%
left: -4px
height: 2em
background-color: $background
width: 5px
margin-top: -1em
&:after
content: "\f35f"
position: absolute
top: 50%
left: -0.5em
color: $color
font-family: "Ionicons"
font-style: normal
line-height: 1em
text-align: center
text-indent: -2px
width: 1em
margin-top: -0.5em
transition: .2s all ease-in-out, .4s transform ease-in-out
&.format:before, &.format:after
display: none
&.book:after
content: "\f12e"
&.podcast:after
content: "\f32d"
&.lyrics:after
content: "\f333"
&.favorite:after
content: "\f384"
&:active:after
transform: rotateY(360deg)
cite
display: block
font-size: 0.75em
line-height: 1.8em
margin-top: 1em
// Media Queries
@media (max-width: 1200px)
body, html
font-size: 18px
@media (max-width: 980px)
body, html
font-size: 16px
.container
max-width: 720px
padding: 0 3em 3em
blockquote
font-size: 1.1em
margin: 1.1em -2em
@media (max-width: 767px)
body, html
font-size: 16px
.container
padding: 0 2em 3em
blockquote
border-top: 2px solid $color
border-bottom: 2px solid $color
border-left: none
margin: 1.5em 0
padding: 1.5em 1em
&:before
left: 50%
top: 0
height: 4px
margin-top: -3px
margin-left: -1em
width: 2em
&:after
font-size: 0.75em
left: 50%
top: 0
margin-top: -0.5em
margin-left: -0.5em
cite
text-align: right
// Scrollbar Exploration
//html::-webkit-scrollbar-track
// background-color: #e5e5e5
//html::-webkit-scrollbar-thumb
// background-color: #a6a6a6
//html::-webkit-scrollbar
// width: 10px
// Nope
Also see: Tab Triggers