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.
html
head
link(href='https://fonts.googleapis.com/css?family=Bad+Script', rel='stylesheet', type='text/css')
link(href='https://fonts.googleapis.com/css?family=Raleway:400,200', rel='stylesheet', type='text/css')
link(href='https://fonts.googleapis.com/css?family=Lato:400,700', rel='stylesheet', type='text/css')
body
select(class='colorPicker')
option(value='1') Grass
option(value='2') Chill
option(value='3') Sky
option(value='4') Rose
option(value='5') Autumn
option(value='6') Cloud
option(value="7") Wine
option(value="8") Ocean
select(class='animationPicker')
option(value='1') moveUp
option(value='2') moveDown
option(value="3") appear
option(value="4") pop
option(value='5') FadeIn
option(value='6') slide
option(value='7') RotateTop
option(value='8') Circle
div.menu-button
div.menu-middlebar
div.menu-info
P
| DavidMenu
span
| 8 color x 8 animation
p
| click the button & feel it !
/*===== DavidFullMenu v0.2 =====
use DavidFullMenu Function to
make your own full screen menu!
===== DavidBackground sheet =====
Grass, Chill, Sky, Rose, Autumn, Wine
===== DavidBackground sheet =====
moveUpMenu, moveDownMenu, moveLeftMenu, moveRightMenu,appearMenu, popAppearMenu, FadeInMenu , SlideInMenu, RotateMenu, CircleMenu*/
light-yellow = #F9C46A
ul,li,div
padding 0
margin 0
body
padding 0
margin 0
max-width 100%
height 400px
background-color light-yellow
.colorPicker,.animationPicker
position absolute
width 120px
top 20px
right 10px
background-color #50514f
color white
outline none
padding 5px 20px 5px 20px
border 5px solid #50514f
font-size 1.2em
cursor pointer
-webkit-appearance none
-moz-appearance none
option
background-color #50514f
color white
transition all .3s ease
-webkit-appearance none
-moz-appearance none
background none
.animationPicker
top 70px
.menu-info
position relative
top 40%
padding 0
margin 0 auto
text-align center
font-size 3em
p
margin 0
color #50514f
font-family Bad Script
span
position relative
top -45px
font-size .5em
font-family Lato
.menu-button
position absolute
top 20px
left 20px
width 40px
height 35px
cursor pointer
transition all .3s ease
&:before, &:after
content ""
position absolute
top 0px
border-radius 5px
width 100%
height 6px
background-color white
transition all .25s ease
&:after
top calc(100% - 6px)
&.addOnMenu
&:before
transform rotate(45deg)
top calc(50% - 3px)
transition all .3s ease
&:after
transform rotate(-45deg)
top calc(50% - 3px)
transition all .3s ease
&.addOnMenu > .menu-middlebar
opacity 0
transition all .3s ease
.menu-middlebar
opacity 1
position relative
top calc(50% - 3px)
width 100%
height 6px
border-radius 5px
background-color white
transition all .2s ease
.menu-container
overflow scroll
position fixed
opacity 0
top 0
left 0
visibility hidden
width 100%
height 100%
transition all .5s ease .35s
z-index 2
background white
&.showOnMenu
opacity 1
visibility visible
transition all .5s ease .15s
nav
display flex
flex-direction column
height 100vh
transition all .6s ease
ul
list-style none
text-align center
li
font-family Raleway
letter-spacing 10px
align-items center
line-height 20vh
a
position relative
cursor pointer
text-decoration none
font-size 2em
color #50514f + 10%
transition all .35s ease
opacity 0
&:before, &:after
content ""
position absolute
background-color light-yellow
bottom 0
left 0
width 100%
transform scaleX(0)
height 2px
transition all .35s ease
&:hover, &:focus
transition all .3s ease
font-size 2.4em
color #50514f - 30%
&:before, &:after
transition all .5s ease
transform scaleX(1)
.moveUpMenu
opacity 1
transition all 1s ease .3s
animation 1s moveup linear
@keyframes moveup
0%
opacity 0
margin-top 100px
100%
opacity 1
margin-top 0px
.moveDownMenu
opacity 1
transition all 1s ease .3s
animation 1s movedown linear
@keyframes movedown
0%
opacity 0
margin-top -100px
100%
opacity 1
margin-top 0px
.moveLeftMenu
opacity 1
transition all 1s ease .3s
animation 1s moveleft linear
@keyframes moveleft
0%
opacity 0
margin-left -100px
100%
opacity 1
margin-left 0px
.moveRightMenu
opacity 1
transition all 1s ease .3s
animation 1s moveright linear
@keyframes moveright
0%
opacity 0
margin-right -100px
100%
opacity 1
margin-right 0px
.appearMenu
opacity 1
transition all 1s ease .3s
animation 1s appear linear
@keyframes appear
0%
opacity 0
35%
opacity 0
transform scale(0.85)
100%
opacity 1
transform scale(1)
.popAppearMenu
opacity 1
transition all .8s ease .3s
animation 1s pop linear
@keyframes pop
0%
opacity 0
transform scale(0)
50%
opacity 0
transform scale(0.7)
70%
opacity .5
transform scale(1.35)
85%
opacity .85
transform scale(0.85)
100%
opacity 1
transform scale(1)
.SlideInMenu
opacity 1
transition all .8s ease
li
opacity 1
for i in (1..10)
&:nth-child({i})
animation .5s slided ease
animation-fill-mode both
animation-delay: i *.25s
@keyframes slided
0%
opacity 0
margin-right 70px
60%
opacity .5
margin-right -70px
100%
opacity 1
margin-right 0px
.FadeInMenu
opacity 1
transition all .8s ease
li
opacity 1
for i in (1..10)
&:nth-child({i})
animation .4s fadein linear
animation-fill-mode both
animation-delay: i *.25s
@keyframes fadein
0%
opacity 0
margin-top 30px
100%
opacity 1
margin-top 0px
.RotateMenu
opacity 1
transition all 1s ease .3s
transform-origin top
animation 1s rotating linear
@keyframes rotating
0%
opacity 0
20%
opacity 0
transform rotate3d(1, 0, 0, -140deg) scale(.6,.6)
100%
opacity 1
.CircleMenu
opacity 1
transition all 1s ease .3s
transform-origin top left
animation .8s cycle linear
@keyframes cycle
0%
opacity 0
49%
opacity 0
50%
transform rotate3d(0, 0, 1, 45deg) scale(.7,.7)
100%
opacity 1
@media(max-width:768px)
body
.colorPicker,.animationPicker
top 15px
padding 5px 10px 5px 10px
width 100px
font-size 1em
.animationPicker
right 120px
.menu-info
font-size 2em
span
top -30px
.menu-container
nav
ul
li
a
font-size 1.5em
&:hover, &:focus
font-size 1.8em
@media(max-width:480px)
body
.menu-info
font-size 1.5em
span
font-size .6em
top -20px
.menu-container
nav
ul
li
a
font-size 1.2em
&:hover, &:focus
font-size 1.5em
// ===== color ===== //
var Grass = "linear-gradient(135deg, #45CC93 0%, #47E593 25%,#70E989 50%,#A7E989 75%)";
var Chill = "linear-gradient(135deg, #00BFB8 0%, #3DCCC7 25%,#6EEAE8 50%,#B3EBEF 75%)";
var Sky = "linear-gradient(135deg, #1493FC 0%, #54B0FD 25%,#81D0FD 50%,#ADE8FD 75%)";
var Rose = "linear-gradient(135deg, #F44453 0%, #F45B69 25%,#FF8284 50%,#FFB0AA 75%)";
var Autumn = "linear-gradient(135deg, #E87153 0%, #F7825A 25%,#FFA56D 50%,#FFC77A 75%)";
var Wine = "linear-gradient(135deg, #841A53 0%, #843B62 25%,#84546E 50%,#84707B 75%)";
var Cloud = "linear-gradient(135deg, #DCDBE0 0%, #E8E8EA 25%,#EDEDF2 50%,#F4F4F8 75%)";
var Ocean = "linear-gradient(135deg, #306F93 0%, #367DA5 25%,#449DD1 50%,#38B1F7 75%)";
var animationType = "moveUpMenu";
var colorType = Grass;
/*===== DavidFullMenu v0.2 =====
use DavidFullMenu Function to
make your own full screen menu!
===== DavidBackground sheet =====
Grass, Chill, Sky, Rose, Autumn, Wine
===== DavidBackground sheet =====
moveUpMenu, moveDownMenu, moveLeftMenu, moveRightMenu,appearMenu, popAppearMenu, FadeInMenu , SlideInMenu, RotateMenu, CircleMenu*/
// vvvvv modify here vvvvvv //
DavidFullMenu({
list: [ {title:"add",url:"https://codepen.io/lichin-lin"},
{title:"content",url:"https://codepen.io/lichin-lin"},
{title:"you like by",url:"http://lichin.me"},
{title:"javascript",url:"http://lichin.me"},
],
DavidMenuAnimation:"moveUpMenu",
DavidBackground: Sky,
});
// ^^^^^ modify here ^^^^^ //
//===== Function start ===== //
function DavidFullMenu(content){
$('body').append('<div class="menu-container"><nav><ul class="menu-list"></ul></nav></div>');
for(var i = 0; i < content.list.length;i++){
$('.menu-container ul').append("<li><a href=" + content.list[i].url + ">" + content.list[i].title + "</a></li>");
}
};
$('.menu-button').on( "click", function() {
$(this).css("z-index", 3)
$('.menu-button').toggleClass("addOnMenu");
$('.menu-container').toggleClass("showOnMenu");
$('.menu-container').css("background",colorType);
$('.menu-container nav').toggleClass(animationType);
});
$('.colorPicker').on(
{ "focus": function() {
this.selectedIndex = -1;
}
, "change": function() {
if($(this).val() == 1){
colorType = Grass;
}else if($(this).val() == 2){
colorType = Chill;
}else if($(this).val() == 3){
colorType = Sky;
}else if($(this).val() == 4){
colorType = Rose;
}else if($(this).val() == 5){
colorType = Autumn;
}else if($(this).val() == 6){
colorType = Cloud;
}else if($(this).val() == 7){
colorType = Wine;
$('.menu-container a').css("color","white");
}else if($(this).val() == 8){
colorType = Ocean;
$('.menu-container a').css("color","white");
}
this.blur();
}
});
$('.animationPicker').on(
{ "focus": function() {
this.selectedIndex = -1;
}
, "change": function() {
if($(this).val() == 1){
animationType = "moveUpMenu";
}else if($(this).val() == 2){
animationType = "moveDownMenu";
}else if($(this).val() == 3){
animationType = "appearMenu";
}else if($(this).val() == 4){
animationType = "popAppearMenu";
}else if($(this).val() == 5){
animationType = "FadeInMenu";
}else if($(this).val() == 6){
animationType = "SlideInMenu";
}else if($(this).val() == 7){
animationType = "RotateMenu";
}else if($(this).val() == 8){
animationType = "CircleMenu";
}
this.blur();
}
});
Also see: Tab Triggers