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="list-container">
<button class="more-button" aria-label="Menu Button">
<div class="menu-icon-wrapper">
<div class="menu-icon-line half first"></div>
<div class="menu-icon-line"></div>
<div class="menu-icon-line half last"></div>
</div>
</button>
<ul class="more-button-list">
<li class="more-button-list-item">
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-settings">
<circle cx="12" cy="12" r="3"/>
<path d="M19.4 15a1.65 1.65 0 00.33 1.82l.06.06a2 2 0 010 2.83 2 2 0 01-2.83 0l-.06-.06a1.65 1.65 0 00-1.82-.33 1.65 1.65 0 00-1 1.51V21a2 2 0 01-2 2 2 2 0 01-2-2v-.09A1.65 1.65 0 009 19.4a1.65 1.65 0 00-1.82.33l-.06.06a2 2 0 01-2.83 0 2 2 0 010-2.83l.06-.06a1.65 1.65 0 00.33-1.82 1.65 1.65 0 00-1.51-1H3a2 2 0 01-2-2 2 2 0 012-2h.09A1.65 1.65 0 004.6 9a1.65 1.65 0 00-.33-1.82l-.06-.06a2 2 0 010-2.83 2 2 0 012.83 0l.06.06a1.65 1.65 0 001.82.33H9a1.65 1.65 0 001-1.51V3a2 2 0 012-2 2 2 0 012 2v.09a1.65 1.65 0 001 1.51 1.65 1.65 0 001.82-.33l.06-.06a2 2 0 012.83 0 2 2 0 010 2.83l-.06.06a1.65 1.65 0 00-.33 1.82V9a1.65 1.65 0 001.51 1H21a2 2 0 012 2 2 2 0 01-2 2h-.09a1.65 1.65 0 00-1.51 1z"/>
</svg>
<span>Settings</span>
</li>
<li class="more-button-list-item">
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-copy">
<rect x="9" y="9" width="13" height="13" rx="2" ry="2"/>
<path d="M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"/>
</svg>
<span>Copy</span>
</li>
<li class="more-button-list-item">
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-share">
<path d="M4 12v8a2 2 0 002 2h12a2 2 0 002-2v-8M16 6l-4-4-4 4M12 2v13"/>
</svg>
<span>Share</span>
</li>
<li class="more-button-list-item">
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-trash-2">
<path d="M3 6h18M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2M10 11v6M14 11v6"/>
</svg>
<span>Delete</span>
</li>
</d>
</div>
<div class="socials">
<a class="social-link" href="https://twitter.com/aybukeceylan" target="_top">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-twitter">
<path d="M23 3a10.9 10.9 0 01-3.14 1.53 4.48 4.48 0 00-7.86 3v1A10.66 10.66 0 013 4s-4 9 5 13a11.64 11.64 0 01-7 2c9 5 20 0 20-11.5a4.5 4.5 0 00-.08-.83A7.72 7.72 0 0023 3z"/>
</svg>
</a>
<a class="social-link" href="https://www.linkedin.com/in/ayb%C3%BCkeceylan/" target="_top">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-linkedin"><path d="M16 8a6 6 0 0 1 6 6v7h-4v-7a2 2 0 0 0-2-2 2 2 0 0 0-2 2v7h-4v-7a6 6 0 0 1 6-6z"/><rect x="2" y="9" width="4" height="12"/><circle cx="4" cy="4" r="2"/></svg>
</a>
</div>
@import url('https://fonts.googleapis.com/css2?family=Montserrat&display=swap');
* { box-sizing: border-box; }
$body-bg: #84a0f4;
$button-bg: #5c67ff;
$list-bg: #fff;
$text-color: #1c3991;
$text-color-hover: #5c67ff;
$menu-icon-transition: transform 300ms cubic-bezier(0.52, -0.80, 0.52, 0.52);
body {
width: 100%;
height: 100vh;
display: flex;
align-items: center;
justify-content: center;
background-color: $body-bg;
background-image: linear-gradient(to top, #84a0f4 0%, #c2e9fb 100%);
font-family: 'Montserrat', sans-serif;
}
.list-container {
position: relative;
&.active {
.more-button-list {
opacity: 1;
transform: scale(1);
}
.more-button-list-item {
animation: fadeInItem .6s .2s forwards;
&:nth-child(2) { animation-delay: .4s; }
&:nth-child(3) { animation-delay: .6s; }
&:nth-child(4) { animation-delay: .8s; }
}
.more-button {
animation: onePulse .6s forwards linear;
}
.menu-icon-wrapper {
transform: rotate(-45deg);
}
.menu-icon-line {
&.first {
transform: rotate(-90deg) translateX(1px);
}
&.last {
transform: rotate(-90deg) translateX(-1px);
}
}
}
}
.more-button {
background-color: $button-bg;
box-shadow: 0px 0px 0px 4px rgba(92,103,255,0.3);
border-radius: 50%;
width: 50px;
height: 50px;
border: none;
padding: 0;
cursor: pointer;
transition: .2s ease-in;
display: flex;
align-items: center;
justify-content: center;
color: #fff;
position: relative;
z-index: 2;
&:hover, &:focus {
box-shadow: 0px 0px 0px 8px rgba(92,103,255,0.3);
background-color: darken($button-bg,4%);
}
&:focus { outline: 0; }
&-list {
background-color: $list-bg;
border-radius: 8px;
list-style-type: none;
width: 140px;
height: 170px;
box-shadow: 0px 0px 4px 4px rgba(150, 157, 249, 0.16);
padding: 0;
padding: 6px;
position: absolute;
right: 24px;
bottom: 0;
opacity: 0;
transform: scale(0);
transform-origin: bottom right;
transition : all .3s ease .1s;
li { opacity: 0; }
}
&-list-item {
display: flex;
align-items: center;
color: $text-color;
padding: 10px;
border-radius: 4px;
cursor: pointer;
position: relative;
transition: .2s ease-in;
transform: translatex(-10px);
&:hover { color: $text-color-hover; }
&:after {
content: '';
position: absolute;
height: 1px;
width: calc(100% - 24px);
left: 12px;
bottom: 0;
background-color: rgba(132, 160, 244, 0.1);
}
&:last-child:after { display: none; }
svg {
width: 18px;
height: 18px;
}
span {
display: inline-block;
line-height: 20px;
font-size: 14px;
margin-left: 8px;
}
}
}
@keyframes onePulse {
0% {
box-shadow: 0px 0px 0px 0px rgba(92,103,255,0.3);
}
50% {
box-shadow: 0px 0px 0px 12px rgba(92,103,255,0.1);
}
100% {
box-shadow: 0px 0px 0px 4px rgba(92,103,255,0.3);
}
}
@keyframes fadeInItem {
100% {
transform: translatex(0px);
opacity: 1;
}
}
.socials {
position: fixed;
bottom: 16px;
right: 16px;
display: flex;
align-items: center;
}
.social-link {
color: #fff;
display: flex;
align-items: center;
cursor: pointer;
text-decoration: none;
margin-right: 12px;
}
.menu-icon-wrapper {
border-radius: 2px;
width: 20px;
height: 20px;
display: flex;
flex-direction: column;
justify-content: space-between;
cursor: pointer;
transition: transform 330ms ease-out;
}
.menu-icon-line {
background-color: #fff;
border-radius: 2px;
width: 100%;
height: 2px;
&.half { width: 50%;}
&.first {
transition: $menu-icon-transition;
transform-origin: right;
}
&.last {
align-self: flex-end;
transition: $menu-icon-transition;
transform-origin: left;
}
}
document.querySelector('.more-button').addEventListener('click', function () {
document.querySelector('.list-container').classList.toggle('active');
});
Also see: Tab Triggers