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.
// Inspired By This Dribble post https://dribbble.com/shots/2321025-Music-Player-Freebie <3 <3 <3
.player
img.cover(src="http://images.genius.com/2216a21a5494b153cb4c24005370d031.700x700x1.jpg", alt="Cover")
.icons
.fa.fa-heart
.fa.fa-random
.info
p.title Leave Your Lover
p.artist Artist - Echos
p.album Album - Echos
.line
.playtime
.played
img.forward(src='data:image/svg+xml;utf8;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iaXNvLTg4NTktMSI/Pgo8IS0tIEdlbmVyYXRvcjogQWRvYmUgSWxsdXN0cmF0b3IgMTYuMC4wLCBTVkcgRXhwb3J0IFBsdWctSW4gLiBTVkcgVmVyc2lvbjogNi4wMCBCdWlsZCAwKSAgLS0+CjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0iQ2FwYV8xIiB4PSIwcHgiIHk9IjBweCIgd2lkdGg9IjEyOHB4IiBoZWlnaHQ9IjEyOHB4IiB2aWV3Qm94PSIwIDAgNDM5LjM1NyA0MzkuMzU3IiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCA0MzkuMzU3IDQzOS4zNTc7IiB4bWw6c3BhY2U9InByZXNl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zl2NDAxLjk4NmMwLDQuOTQ4LDEuODA3LDkuMjM2LDUuNDI0LDEyLjg0N2MzLjYyMSwzLjYyLDcuOTAyLDUuNDI4LDEyLjg1LDUuNDI4aDM2LjU0MyAgIGM0Ljk0NywwLDkuMjI5LTEuODA4LDEyLjg0Ny01LjQyOGMzLjYxNS0zLjYxLDUuNDI0LTcuODk4LDUuNDI0LTEyLjg0N1YyMjcuMDk3YzAuNzYzLDEuOTAzLDIsMy43MTcsMy43MTUsNS40MjVsMjAyLjcwNSwyMDIuNzEyICAgYzMuNjIxLDMuNjE3LDYuNjY3LDQuODU5LDkuMTM4LDMuNzJjMi40NzgtMS4xNDQsMy43MTYtNC4xODksMy43MTYtOS4xMzhWOS41NDdDMzY1Ljg2Miw0LjU5OSwzNjQuNjI0LDEuNTUzLDM2Mi4xNDYsMC40MTJ6IiBmaWxsPSIjRkZGRkZGIi8+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPC9zdmc+Cg==')
.fa.fa-volume-up.fa-2x
p.songtime 4:20
p.timeleft 1:44
svg#Capa_1(xmlns='http://www.w3.org/2000/svg', xmlns:xlink='http://www.w3.org/1999/xlink', version='1.1', x='0px', y='0px', viewbox='0 0 512 512', style='enable-background:new 0 0 512 512;', xml:space='preserve', width='512px', height='512px')
path(d='M256,0C114.617,0,0,114.615,0,256s114.617,256,256,256s256-114.615,256-256S397.383,0,256,0z M344.48,269.57l-128,80 c-2.59,1.617-5.535,2.43-8.48,2.43c-2.668,0-5.34-0.664-7.758-2.008C195.156,347.172,192,341.82,192,336V176 c0-5.82,3.156-11.172,8.242-13.992c5.086-2.836,11.305-2.664,16.238,0.422l128,80c4.676,2.93,7.52,8.055,7.52,13.57 S349.156,266.641,344.48,269.57z', fill='#72e6cf')
g
g
g
g
g
g
g
g
g
g
g
g
g
g
g
body
height 700px
width 100vw
display flex
align-items center
justify-content center
.player
width 800px
height 529px
background #6b6d83
box-shadow 0px 24px 54px -12px rgba(94,97,120,1)
position absolute
left 50%
transform translateX(-400px)
top 20%
.cover
width 230px
position absolute
left 50%
transform translateX(-115px)
top -40px
box-shadow 5px 20px 50px 0px rgba(#111, 0.4)
.icons
position absolute
right 40px
top 40px
.fa
color #72e6cf
margin-left 15px
font-size 20px
.info
position absolute
top 240px
left 20%
color #fff
font-family Open Sans
letter-spacing 1px
.title
font-size 2em
margin 0
.artist
color #bdbdbd
.line
height 3px
width 100%
background-color #525363
position absolute
top 400px
.playtime
background-color rgba(114, 230, 207, 0.3)
height 5px
width 100%
position absolute
bottom 0px
.played
background-color #72e6cf
height 5px
width 300px
position absolute
bottom 0px
svg
width 85px
background-color #fff
border-radius 50%
height 85px
position absolute
left 50%
transform translateX(-42.5px)
bottom 25px
box-shadow 0px 0px 40px 0px rgba(0,0,0,0.4)
.forward
width 30px
position absolute
bottom 55px
right -70%
.backward
width 30px
position absolute
bottom 55px
left 36%
.fa.fa-volume-up
color #fff
position absolute
bottom 53px
right 28%
p.songtime
color #fff
position absolute
right 20px
bottom 45px
p.timeleft
color #fff
position absolute
left 20px
bottom 45px
.fa.fa-heart.liked
color #ff749f
$(()=>{
$(".fa.fa-heart").on('click', ()=>{
$('.fa.fa-heart').toggleClass('liked')
})
})
Also see: Tab Triggers