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="wrapper">
<nav class="menu">
<ul>
<li class="menu-item">
<svg viewBox="0 0 200 235" class="svg-fill active">
<path d="M148,220 L111.793103,220 C114.400013,216.088612 116.089651,211.639476 116.862069,206.652457 C117.34483,203.718916 117.586207,199.563129 117.586207,194.184971 L117.586207,66.283237 C117.586207,62.6652035 116.668975,59.6094778 114.834483,57.1159682 C112.999991,54.6224586 110.055193,52.8868064 106,51.9089595 L142.496552,17 L142.496552,194.184971 C142.496552,199.269775 142.737929,203.278887 143.22069,206.212428 C144.08966,211.101662 145.682747,215.697474 148,220 Z" id="1"></path>
</svg>
<svg viewBox="0 0 200 235" class="svg-border active">
<path d="M148,220 L111.793103,220 C114.400013,216.088612 116.089651,211.639476 116.862069,206.652457 C117.34483,203.718916 117.586207,199.563129 117.586207,194.184971 L117.586207,66.283237 C117.586207,62.6652035 116.668975,59.6094778 114.834483,57.1159682 C112.999991,54.6224586 110.055193,52.8868064 106,51.9089595 L142.496552,17 L142.496552,194.184971 C142.496552,199.269775 142.737929,203.278887 143.22069,206.212428 C144.08966,211.101662 145.682747,215.697474 148,220 Z" id="1"></path>
</svg>
<a href="#0" class="active"><div></div>Home</a>
</li>
<li class="menu-item">
<svg viewBox="0 0 200 235" class="svg-fill">
<path d="M182,220 L70,220 L70,197.187592 C76.5480258,189.875887 82.3629763,183.246706 87.4450262,177.299852 C89.301929,175.155085 94.6770934,168.672137 103.570681,157.850812 C108.359535,152.001448 113.197183,146.103427 118.08377,140.156573 C129.616114,126.410566 138.167511,114.614525 143.73822,104.768095 C150.481709,92.8743866 153.853403,82.3456884 153.853403,73.1816839 C153.853403,64.9925735 151.214686,58.4121371 145.937173,53.4401773 C140.659659,48.4682174 133.916271,45.9822747 125.706806,45.9822747 C121.113415,45.9822747 116.544525,47.1521301 112,49.4918759 C107.455475,51.8316217 103.228641,55.1462119 99.3193717,59.4357459 L79.0890052,35.1610044 C86.71208,30.4815128 93.1622773,27.3131545 98.4397906,25.6558346 C106.062865,23.2185993 115.738161,22 127.465969,22 C144.178094,22 157.56714,26.7769094 167.633508,36.3308715 C177.211217,45.3973865 182,56.7059884 182,70.2570162 C182,78.8360843 180.240855,87.7074874 176.722513,96.8714919 C173.69283,104.670645 169.099507,113.347072 162.942408,122.901034 C158.446749,129.920271 152.289742,138.401723 144.471204,148.345643 C137.923178,156.924711 130.691139,165.796114 122.774869,174.960118 C116.324575,182.369313 110.265299,188.998494 104.596859,194.847858 L157.078534,194.847858 C163.333365,194.847858 167.780092,194.50665 170.418848,193.824225 C173.93719,192.84933 177.797536,190.655852 182,187.243722 L182,220 Z" id="2"></path>
</svg>
<svg viewBox="0 0 200 235" class="svg-border">
<path d="M182,220 L70,220 L70,197.187592 C76.5480258,189.875887 82.3629763,183.246706 87.4450262,177.299852 C89.301929,175.155085 94.6770934,168.672137 103.570681,157.850812 C108.359535,152.001448 113.197183,146.103427 118.08377,140.156573 C129.616114,126.410566 138.167511,114.614525 143.73822,104.768095 C150.481709,92.8743866 153.853403,82.3456884 153.853403,73.1816839 C153.853403,64.9925735 151.214686,58.4121371 145.937173,53.4401773 C140.659659,48.4682174 133.916271,45.9822747 125.706806,45.9822747 C121.113415,45.9822747 116.544525,47.1521301 112,49.4918759 C107.455475,51.8316217 103.228641,55.1462119 99.3193717,59.4357459 L79.0890052,35.1610044 C86.71208,30.4815128 93.1622773,27.3131545 98.4397906,25.6558346 C106.062865,23.2185993 115.738161,22 127.465969,22 C144.178094,22 157.56714,26.7769094 167.633508,36.3308715 C177.211217,45.3973865 182,56.7059884 182,70.2570162 C182,78.8360843 180.240855,87.7074874 176.722513,96.8714919 C173.69283,104.670645 169.099507,113.347072 162.942408,122.901034 C158.446749,129.920271 152.289742,138.401723 144.471204,148.345643 C137.923178,156.924711 130.691139,165.796114 122.774869,174.960118 C116.324575,182.369313 110.265299,188.998494 104.596859,194.847858 L157.078534,194.847858 C163.333365,194.847858 167.780092,194.50665 170.418848,193.824225 C173.93719,192.84933 177.797536,190.655852 182,187.243722 L182,220 Z" id="2"></path>
</svg>
<a href="#0"><div></div>About</a>
</li>
<li class="menu-item">
<svg viewBox="0 0 200 235" class="svg-fill">
<path d="M190,151.507289 C190,172.603604 183.172111,189.890603 169.516129,203.368805 C156.250318,216.456334 139.668302,223 119.769585,223 C107.771829,223 98.115244,222.218667 90.7995392,220.655977 C82.0206934,218.800282 72.754273,215.186616 63,209.814869 L81.7281106,182.272595 C86.995418,188.132682 92.2382612,192.185849 97.4567972,194.432216 C102.675333,196.678583 110.307937,197.801749 120.354839,197.801749 C131.767338,197.801749 141.838474,193.333499 150.568548,184.396866 C159.298623,175.460232 163.663594,164.887816 163.663594,152.6793 C163.663594,138.322086 158.73776,127.578753 148.885945,120.44898 C140.49727,114.393556 129.231254,111.365889 115.087558,111.365889 L115.087558,89.3906706 C125.622172,87.6326443 133.13285,85.3374777 137.619816,82.505102 C144.057636,78.5007088 147.276498,72.3965425 147.276498,64.1924198 C147.276498,59.6020179 145.447599,55.6221014 141.789747,52.252551 C138.131894,48.8830006 133.913234,47.1982507 129.133641,47.1982507 C124.646675,47.1982507 120.4524,47.9551674 116.550691,49.4690233 C112.648982,50.9828793 108.747331,53.2536292 104.845622,56.2813411 L89.3364055,31.0830904 C95.7742257,27.8600422 101.773014,25.540459 107.332949,24.1242711 C112.892885,22.7080833 119.184297,22 126.207373,22 C139.863356,22 151.71462,25.5159998 161.761521,32.548105 C172.783849,40.263887 178.294931,50.2258865 178.294931,62.4344023 C178.294931,69.5641756 176.612344,75.9125086 173.24712,81.4795918 C169.881896,87.0466751 165.029218,91.7346748 158.68894,95.5437318 C166.980072,99.2551206 174.003043,105.55462 179.758065,114.44242 C186.586056,125.088246 190,137.443078 190,151.507289 Z" id="3"></path>
</svg>
<svg viewBox="0 0 200 235" class="svg-border">
<path d="M190,151.507289 C190,172.603604 183.172111,189.890603 169.516129,203.368805 C156.250318,216.456334 139.668302,223 119.769585,223 C107.771829,223 98.115244,222.218667 90.7995392,220.655977 C82.0206934,218.800282 72.754273,215.186616 63,209.814869 L81.7281106,182.272595 C86.995418,188.132682 92.2382612,192.185849 97.4567972,194.432216 C102.675333,196.678583 110.307937,197.801749 120.354839,197.801749 C131.767338,197.801749 141.838474,193.333499 150.568548,184.396866 C159.298623,175.460232 163.663594,164.887816 163.663594,152.6793 C163.663594,138.322086 158.73776,127.578753 148.885945,120.44898 C140.49727,114.393556 129.231254,111.365889 115.087558,111.365889 L115.087558,89.3906706 C125.622172,87.6326443 133.13285,85.3374777 137.619816,82.505102 C144.057636,78.5007088 147.276498,72.3965425 147.276498,64.1924198 C147.276498,59.6020179 145.447599,55.6221014 141.789747,52.252551 C138.131894,48.8830006 133.913234,47.1982507 129.133641,47.1982507 C124.646675,47.1982507 120.4524,47.9551674 116.550691,49.4690233 C112.648982,50.9828793 108.747331,53.2536292 104.845622,56.2813411 L89.3364055,31.0830904 C95.7742257,27.8600422 101.773014,25.540459 107.332949,24.1242711 C112.892885,22.7080833 119.184297,22 126.207373,22 C139.863356,22 151.71462,25.5159998 161.761521,32.548105 C172.783849,40.263887 178.294931,50.2258865 178.294931,62.4344023 C178.294931,69.5641756 176.612344,75.9125086 173.24712,81.4795918 C169.881896,87.0466751 165.029218,91.7346748 158.68894,95.5437318 C166.980072,99.2551206 174.003043,105.55462 179.758065,114.44242 C186.586056,125.088246 190,137.443078 190,151.507289 Z" id="3"></path>
</svg>
<a href="#0"><div></div>Widgets</a>
<ul class="sub-menu">
<li class="menu-item"><a href="#0">Big Widgets</a></li>
<li class="menu-item"><a href="#0">Bigger Widgets</a></li>
<li class="menu-item"><a href="#0">Huge Widgets</a></li>
</ul>
</li>
<li class="menu-item">
<svg viewBox="0 0 200 235" class="svg-fill">
<path d="M195,161.041605 L156.800971,161.041605 L156.800971,193.240713 C156.800971,198.314538 157.047732,202.314993 157.541262,205.242199 C158.429616,210.120876 160.058241,214.706764 162.427184,219 L125.116505,219 C127.781567,215.097058 129.508896,210.657529 130.298544,205.681278 C130.792074,202.754072 131.038835,198.607258 131.038835,193.240713 L131.038835,161.041605 L73,161.041605 L73,141.429421 L117.121359,42.4903418 C118.108419,40.3437238 119.095464,37.3677753 120.082524,33.5624071 C121.069584,29.7570389 121.85922,25.9029418 122.451456,22 L155.024272,22 L102.61165,136.160475 L131.038835,136.160475 L131.038835,84.3491828 L156.800971,71.1768202 L156.800971,136.160475 L195,136.160475 L195,161.041605 Z" id="4"></path>
</svg>
<svg viewBox="0 0 200 235" class="svg-border">
<path d="M195,161.041605 L156.800971,161.041605 L156.800971,193.240713 C156.800971,198.314538 157.047732,202.314993 157.541262,205.242199 C158.429616,210.120876 160.058241,214.706764 162.427184,219 L125.116505,219 C127.781567,215.097058 129.508896,210.657529 130.298544,205.681278 C130.792074,202.754072 131.038835,198.607258 131.038835,193.240713 L131.038835,161.041605 L73,161.041605 L73,141.429421 L117.121359,42.4903418 C118.108419,40.3437238 119.095464,37.3677753 120.082524,33.5624071 C121.069584,29.7570389 121.85922,25.9029418 122.451456,22 L155.024272,22 L102.61165,136.160475 L131.038835,136.160475 L131.038835,84.3491828 L156.800971,71.1768202 L156.800971,136.160475 L195,136.160475 L195,161.041605 Z" id="4"></path>
</svg>
<a href="#0"><div></div>Kabobs</a>
<ul class="sub-menu">
<li class="menu-item"><a href="#0">Shishkabobs</a></li>
<li class="menu-item"><a href="#0">BBQ kabobs</a></li>
<li class="menu-item"><a href="#0">Summer kabobs</a></li>
</ul>
</li>
<li class="menu-item">
<svg viewBox="0 0 200 235" class="svg-fill">
<path d="M190,144.604106 C190,168.476659 183.163478,187.51056 169.49023,201.706378 C155.816981,215.902197 136.767172,223 112.34023,223 C102.219106,223 93.6795367,221.943926 86.7212644,219.831745 C79.762992,217.719564 71.855983,213.568946 63,207.379765 L81.6850575,180.854839 C86.6483007,185.570405 91.9034205,189.254386 97.4505747,191.906891 C103.776277,194.952361 110.296518,196.475073 117.011494,196.475073 C130.149491,196.475073 141.121987,191.735018 149.92931,182.254765 C158.736634,172.774513 163.14023,161.010334 163.14023,146.961877 C163.14023,135.762407 159.685475,126.577015 152.775862,119.405425 C145.476975,111.840871 135.891247,108.058651 124.018391,108.058651 C117.790007,108.058651 112.169948,108.721768 107.158046,110.048021 C102.146144,111.374273 97.0613285,113.756581 91.9034483,117.195015 L91.9034483,22 L181.241379,22 L181.241379,56.4824047 C176.472773,52.7492482 172.531433,50.2441413 169.417241,48.9670088 C166.30305,47.6898763 162.264393,47.0513196 157.301149,47.0513196 L116.135632,47.0513196 L116.135632,83.0073314 C119.736416,82.2214037 124.310317,81.8284457 129.857471,81.8284457 C147.3748,81.8284457 161.777721,87.6245755 173.066667,99.2170088 C184.355612,110.809442 190,125.938323 190,144.604106 Z" id="5"></path>
</svg>
<svg viewBox="0 0 200 235" class="svg-border">
<path d="M190,144.604106 C190,168.476659 183.163478,187.51056 169.49023,201.706378 C155.816981,215.902197 136.767172,223 112.34023,223 C102.219106,223 93.6795367,221.943926 86.7212644,219.831745 C79.762992,217.719564 71.855983,213.568946 63,207.379765 L81.6850575,180.854839 C86.6483007,185.570405 91.9034205,189.254386 97.4505747,191.906891 C103.776277,194.952361 110.296518,196.475073 117.011494,196.475073 C130.149491,196.475073 141.121987,191.735018 149.92931,182.254765 C158.736634,172.774513 163.14023,161.010334 163.14023,146.961877 C163.14023,135.762407 159.685475,126.577015 152.775862,119.405425 C145.476975,111.840871 135.891247,108.058651 124.018391,108.058651 C117.790007,108.058651 112.169948,108.721768 107.158046,110.048021 C102.146144,111.374273 97.0613285,113.756581 91.9034483,117.195015 L91.9034483,22 L181.241379,22 L181.241379,56.4824047 C176.472773,52.7492482 172.531433,50.2441413 169.417241,48.9670088 C166.30305,47.6898763 162.264393,47.0513196 157.301149,47.0513196 L116.135632,47.0513196 L116.135632,83.0073314 C119.736416,82.2214037 124.310317,81.8284457 129.857471,81.8284457 C147.3748,81.8284457 161.777721,87.6245755 173.066667,99.2170088 C184.355612,110.809442 190,125.938323 190,144.604106 Z" id="5"></path>
</svg>
<a href="#0"><div></div>Contact</a>
</li>
</ul>
</nav>
</div>
body{
margin:0;
}
.wrapper {
display: flex;
width:100%;
height:100vh;
overflow:hidden;
}
nav.menu {
position:relative;
margin: auto;
width:100vmin;
height:40vmin;
// overflow-y:hidden;
}
nav.menu > ul {
margin:0;
padding:0;
list-style-position: inside;
list-style-type:none;
height:100%;
}
nav.menu > ul > li.menu-item {
display:inline-block;
margin-right:-4px;
width:20%; height:100%;
box-sizing:border-box;
border-right:1px solid #000;
vertical-align:top;
position:absolute;
&:first-child {
border-left:1px solid #000;
left:0;
}
&:nth-child(2) {
left:20vmin;
}
&:nth-child(3) {
left:40vmin;
}
&:nth-child(4) {
left:60vmin;
}
&:nth-child(5) {
left:80vmin;
}
}
nav.menu > ul > li.menu-item > a {
display:inline-block;
font-size:2.5vmin;
line-height:3vmin;
padding:2px 2vmin 2px 1vmin;
background:#fff;
color:#000;
text-decoration:none;
font-family: 'Arimo', sans-serif;
position:absolute;
left:2vmin;top:18vmin;
transform-origin:center;
opacity:0;
transition:.5s ease-in-out;
div {
position:relative;
display:inline-block;
margin-right:1vmin;
background:#000;
width:1vmin;height:1vmin;
}
}
nav.menu > ul > li.menu-item:hover a {
transform:translatex(2vmin);
opacity:1;
}
nav.menu > ul > li.menu-item:hover a:hover {
transition:none;
color:#ff0000;
border-color:#ff0000;
}
nav.menu > ul > li.menu-item:hover a:hover div{
background:#ff0000;
}
ul.sub-menu {
list-style-position: inside;
padding:0;
position:absolute;
top:31vmin;
left:2vmin;
}
ul.sub-menu > li.menu-item {
display:block;
width:100%;
height:3vmin;
}
ul.sub-menu > li.menu-item {
a {
font-size:2vmin;
color:#000;
text-decoration:none;
font-family: 'Arimo', sans-serif;
background:none;
padding-left:2vmin;
border-left: 1px solid #000;
}
transform-origin:left;
transition: .4s ease-in-out;
opacity:0;
&:first-child{
transition-delay:.3s;
}
&:nth-child(2){
transition-delay:.4s;
}
&:last-child{
transition-delay:.5s;
}
}
nav.menu > ul > li.menu-item:hover ul.sub-menu > li.menu-item {
opacity:1;
transform:translatey(-2vmin);
}
svg.svg-fill {
fill:#ff0000;
stroke:none;
transition:.5s ease-in-out;
opacity:0;
position:relative;
top:5vmin;
transform-origin:right bottom;
transform:scale(.9);
}
svg.svg-border {
fill:none;
stroke:#000000;
stroke-width:3px;
opacity:.7;
transition:.5s ease-in-out;
position:relative;
top:-20vmin;
left:-1vmin;
transform-origin:right bottom;
transform:scale(.8);
}
nav.menu > ul > li.menu-item:hover svg{
opacity:1;
transform:scale(1);
}
svg.active {
opacity:1;
transform:scale(1);
}
nav.menu > ul > li.menu-item > a.active {
transform:translatex(2vmin);
opacity:1;
}
// useful reference: https://css-tricks.com/fighting-the-space-between-inline-block-elements/
$("nav.menu ul li.menu-item").hover(function(){
$('nav.menu ul li.menu-item').children().removeClass("active");
})
Also see: Tab Triggers