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.
<div class="pfl-wrapper">
<nav id="nav">
<div class="nav-icon"><span></span></div>
<div class="hire-me">Hire me</div>
</nav>
<article>
<div class="profile-photo"></div>
<div class="profile-info">
<h1>Nick Lewis</h1>
<p>Creative technologist <a href="http://fiascodesign.co.uk/" target="_blank">@FiascoDesign</a>. Maker of web things. Joint owner <a href="http://mountainandco.uk/" target="_blank">@mountainandco</a>.</p>
</div>
<div class="col-xs-12">
<div class="col-md-6 people">
<a href="https://codepen.io/nickylew/" class="col-xs-12 col-lg-6 round-tile">
<div class="roundal codepen"></div>
<h4>CodePen</h4>
</a>
<a href="https://www.instagram.com/nickylewlew/" class="col-xs-12 col-lg-6 round-tile">
<div class="roundal instagram"></div>
<h4>Instagram</h4>
</a>
<a href="https://twitter.com/nickylewlew/" class="col-xs-12 col-lg-6 round-tile">
<div class="roundal twitter"></div>
<h4>Twitter</h4>
</a>
</div>
<div class="col-md-6 posts">
<div class="col-xs-12 col-lg-12 col-xl-6 tile">
<div class="inner">
<img src="http://nickylew.com/wp-content/uploads/2016/04/app.gif"/>
<h4>Improving UX with animation</h4>
</div>
</div>
<div class="col-xs-12 col-lg-12 col-xl-6 tile">
<div class="inner">
<img src="http://nickylew.com/wp-content/uploads/2016/12/yes-man-900x600.jpeg"/>
<h4>Learning how to be a yes man</h4>
</div>
</div>
<div class="col-xs-12 col-lg-12 col-xl-6 tile">
<div class="inner">
<img src="http://nickylew.com/wp-content/uploads/2015/07/Studio-3.jpg"/>
<h4>Life as a designer and developer</h4>
</div>
</div>
<div class="col-xs-12 col-lg-12 col-xl-6 tile">
<div class="inner">
<img src="http://nickylew.com/wp-content/uploads/2015/07/AppleWatch.jpg"/>
<h4>What does the future hold for UI?</h4>
</div>
</div>
</div>
</div>
</article>
</div>
body
width 100%
height 100%
min-height 100vh
margin 0
background-color #f1deda
font-family 'Poppins', sans-serif
color rgba(0,0,0,0.8)
.pfl-wrapper
display block
width auto
height 100%
padding 40px
margin 50px
background-color #f1deda
box-shadow 0 0 50px rgba(0,0,0,0.08)
overflow auto
#nav
display block
position absolute
top 50px
left 50px
right 50px
width auto
height auto
&:hover
.nav-icon
span
width 100%
&:before,
&:after
width 100%
transition all 0.25s
.nav-icon
display block
width 30px
height 17px
position absolute
top 40px
left 40px
&:after
display block
content "Menu"
padding-left 45px
line-height 15px
span
display block
width 100%
height 2px
background-color rgba(0,0,0,0.7)
position absolute
&:before,
&:after
display block
content ""
width 100%
height 2px
background-color rgba(0,0,0,0.7)
transition all 0.25s
&:before
margin-top 7px
width 80%
&:after
margin-top 5px
width 60%
.hire-me
display block
position absolute
top 34px
right 50px
padding-right 10px
&:after
display block
content ""
width 15px
height 2px
background-color rgba(0,0,0,0.7)
position absolute
left 100%
top 50%
article
display block
width auto
height auto
padding 50px 0
overflow auto
.profile-photo
display block
width 130px
height 130px
border-radius 50%
background-color white
margin 0 auto
background-image url('http://nickylew.com/wp-content/uploads/2017/05/nickylew-2017.jpg')
background-size 230%
background-position 80% 0%
background-repeat no-repeat
.profile-info
display block
width 100%
max-width 400px
margin 0 auto
text-align center
h1
font-size 2em
font-weight 600
margin-top 0.5em
.people,
.posts
display inline-block
width 100%
margin 60px 0 0
float left
.people
.round-tile
display inline-block
float left
margin-bottom 30px
text-align center
text-decoration none
&:hover
text-decoration none
.roundal
box-shadow 0 0 50px rgba(0,0,0,0.08)
transition box-shadow 0.25s
h4
color rgb(2, 117, 216)
transition color 0.25s
text-decoration none
.roundal
display block
margin 0 auto 10px
width 90px
height 90px
background-color #363636
border-radius 50%
-webkit-border-radius 50%
transition box-shadow 0.25s
&.twitter
background-color #1da1f2
background-image url('http://www.macdrifter.com/theme/images/twitter-snow.svg')
background-size 50% auto
background-position center center
background-repeat no-repeat
&.codepen
background-color black
background-image url('https://www.shareicon.net/download/2016/11/03/849433_codepen_512x512.png')
background-size 115% auto
background-position center center
background-repeat no-repeat
&.instagram
background-color transparent
background-image url('http://sevenfiguresocial.com/wp-content/uploads/2016/08/instagram_gradient_wallpaper_by_jasonzigrino-da28exh-550x400.png')
background-size auto 100%
background-position center center
background-repeat no-repeat
position relative
overflow hidden
&:before
display block
content ""
width 100%
height 100%
position absolute
top 0
left 0
background-image url('https://sirgo.org/images/instagram-black-and-white-cliparts-11.png')
background-size 50% auto
background-position center center
background-repeat no-repeat
z-index 1
h4
font-size 1.1em
color rgba(32,32,32,0.6)
transition color 0.25s
text-decoration none
.posts
.tile
display inline-block
float left
margin-bottom 30px
&:nth-of-type(2n+1)
clear both
.inner
display block
width 100%
overflow hidden
border-radius 5px
-webkit-border-radius 5px
background-color white
cursor pointer
transition box-shadow 0.25s
img
width 100%
height auto
h4
font-size 1.1em
line-height 1.4em
padding 20px 15px 10px
transition color 0.25s
&:hover
box-shadow 0 0 50px rgba(0,0,0,0.08)
transition box-shadow 0.25s
h4
color rgb(2, 117, 216)
transition color 0.25s
@media (min-width: 992px)
article
.people
.round-tile
&:nth-of-type(2)
transform translateY(80px) translateX(-20%)
&:nth-of-type(3)
transform translateY(20px)
@media (min-width: 1200px)
article
.people
.round-tile
&:nth-of-type(2)
transform translateY(80px) translateX(-40%)
@media (min-width: 1400px)
article
.people
.round-tile
&:nth-of-type(2)
transform translateY(80px) translateX(-50%)
@media (max-width: 480px)
.pfl-wrapper
margin 30px
padding 40px 0 0
article
.profile-info
padding 0 30px
#nav
.nav-icon
top 10px
left 10px
.hire-me
top 5px
right 10px
Also see: Tab Triggers