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.
link(href="https://fonts.googleapis.com/css?family=Ubuntu" rel="stylesheet")
link(href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css", rel="stylesheet", integrity="sha384-T8Gy5hrqNKT+hzMclPo118YTQO6cYprQmhrYwIiQ/3axmI1hQomh7Ud2hPOy8SP1", crossorigin="anonymous")
.profile-card-1
.img
img(src="http://blogs.timesofindia.indiatimes.com/wp-content/uploads/2015/12/mark-zuckerberg.jpg")
a(href="").view-more
i(class="fa fa-plus-circle" aria-hidden="true")
.popup
.mid-section
.name Mark Zuckerberg
.description Founder and Owner at
a(href="https://facebook.com") Facebook
.line
.stats
.stat 81.3M
.subtext Followers
.stat 822k
.subtext Likes
.stat 750k
.subtext Shares
.links
a(href="").fb
i(class="fa fa-facebook-f" aria-hidden="true")
a(href="").twitter
i(class="fa fa-twitter" aria-hidden="true")
a(href="").follow
i(class="fa fa-rocket" aria-hidden="true")
$main-bg-color: #F2F2F2
$main-color: #2ECC71
$main-bg: linear-gradient(rgba(46,204,113, .4), rgba(46,204,113, .95)), url("https://static.pexels.com/photos/21014/pexels-photo-medium.jpg")
$sub-color: #97e7b9
$grey: #979797
$fb-color: #3b5998
$twitter-color: #55ACEE
$follow-color: $main-color
$top-height: 130px
$bottom-height: 50px
$link-border: lighten($main-color, 6%)
$total-height: 390px
$mid-height: 200px
body
background: $main-bg-color
font-family: 'Ubuntu', sans-serif
.profile-card-1
width: 300px
height: $total-height
background: white
margin: 0 auto
border-radius: 10px
text-align: center
box-shadow: 4px 4px 10px #999
position: relative
box-sizing: border-box
overflow: hidden
.view-more
position: absolute
top: calc(50% - .5em)
left: calc(50% - .5em)
z-index: 2
color: $main-color
font-size: 2em
.fa-plus-circle
position: absolute
background: white
border-radius: 50%
width: 1.004em
&:hover
background: $main-color
color: white
.popup
height: 500px
width: 500px
display: block
position: absolute
top: 0
left: 0
.mid-section
position: absolute
height: $mid-height
width: 100%
top: $mid-height
left: 0
padding: 10px 20px 0
box-sizing: border-box
background: white
.name
color: lighten(black, 20%)
font-size: 1.4em
padding-top: 5px
background: rgba(255,255,255,.1)
font-weight: bold
.description
color: lighten(black, 50%)
font-size: .9em
padding-bottom: 5px
background: rgba(255,255,255,.1)
a
color: inherit
text-decoration: none
font-weight: bold
.line
background: lighten($main-color, 20%)
width: 80%
height: 2px
margin: 5px auto -3px
.stats
display: flex
position: absolute
left: 10%
padding-top: 10px
width: 80%
justify-content: space-around
.stat
font-size: 1.3em
color: lighten(black, 20%)
padding: 5px
font-weight: bold
.subtext
color: lighten(black, 50%)
font-size: .6em
font-weight: normal
.img
height: $top-height
width: 100%
background-image: $main-bg
padding: 20px
box-sizing: border-box
position: relative
img
width: 160px
height: 160px
padding: 3px
border-radius: 50%
border: 3px solid rgba(255,255,255,.6)
position: absolute
left: calc(50% - 84px)
top: 26px
&:after
content: ""
position: absolute
width: 180px
height: 180px
border-radius: 50%
left: calc(50% - 91.5px)
top: 20px
border: 3px solid rgba(255,255,255,.4)
&:before
content: ""
position: absolute
width: 190px
height: 190px
border-radius: 50%
left: calc(50% - 95px)
top: 15.5px
border: 2px solid rgba(255,255,255,.2)
.links
width: 100%
height: $bottom-height
background: $main-bg-color
border-top: 1px solid $link-border
margin-top: 35px
border-radius: 5px
color: white
font-size: 2em
line-height: 1.5em
position: absolute
bottom: 0
a
color: white
.fb
position: absolute
left: 0
width: 25%
height: 100%
background-color: $fb-color
&:hover
background-color: lighten($fb-color, 5%)
.twitter
position: absolute
left: 25%
width: 25%
height: 100%
background-color: $twitter-color
&:hover
background-color: lighten($twitter-color, 5%)
.follow
position: absolute
left: 50%
width: 50%
height: 100%
background-color: $follow-color
&:hover
background-color: lighten($follow-color, 5%)
.profile-card-2
width: 250px
height: 500px
background: $main-color
// no js
Also see: Tab Triggers