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="popup-container">
<label class="button" for="login-popup">LOGIN</label>
<input type="checkbox" id="login-popup">
<div class="popup">
<label for="login-popup"></label>
<div class="inner">
<div class="title">
<h6>LOGIN</h6>
<label for="login-popup">
<i class="fa fa-times"></i>
</label>
</div>
<div class="content">
<ul>
<li>
<input type="text" placeholder="Username">
</li>
<li>
<input type="password" placeholder="Password">
</li>
<li>
<button type="submit">Login</button>
</li>
</ul>
</div>
</div>
</div>
</div>
<div class="popup-container">
<label class="button" for="register-popup">REGISTER</label>
<input type="checkbox" id="register-popup">
<div class="popup">
<label for="register-popup"></label>
<div class="inner">
<div class="title">
<h6>REGISTER</h6>
<label for="register-popup">
<i class="fa fa-times"></i>
</label>
</div>
<div class="content">
<ul>
<li>
<input type="text" placeholder="Username">
</li>
<li>
<input type="text" placeholder="E-mail address">
</li>
<li>
<input type="password" placeholder="Password">
</li>
<li>
<button type="submit">Register</button>
</li>
</ul>
</div>
</div>
</div>
</div>
<div class="popup-container">
<label class="button" for="contract-popup">CONTRACT</label>
<input type="checkbox" id="contract-popup">
<div class="popup">
<label for="contract-popup"></label>
<div class="inner">
<div class="title">
<h6>CONTRACT</h6>
<label for="contract-popup">
<i class="fa fa-times"></i>
</label>
</div>
<div class="content">
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean faucibus luctus felis, sodales rutrum mi. Nullam vitae justo vel augue cursus tincidunt at vitae libero. Donec arcu massa, posuere in lacus quis, ultricies tempor tellus. Nulla facilisi. Vivamus commodo ac elit et finibus. Nam turpis dolor, facilisis ac augue at, imperdiet fermentum metus. Duis volutpat nisi vel nunc tincidunt, nec dignissim lacus porttitor. Nulla pharetra metus at sem scelerisque, non hendrerit neque consectetur. Ut sagittis, felis sed tincidunt molestie, ligula nunc rhoncus augue, auctor hendrerit est purus eget magna. Sed libero enim, volutpat et vulputate id, aliquam id massa.
</p>
<p>
Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Cras nec ligula imperdiet, porta lectus vel, semper purus. Aenean gravida, nisi vel vulputate congue, nisl lectus porttitor est, at consectetur lectus quam vitae neque. Sed sit amet neque et tellus mattis aliquet. Donec luctus, nisl at congue dapibus, diam augue pharetra leo, eu maximus mi purus imperdiet mi. Pellentesque a auctor nulla. Vestibulum feugiat tristique nisi quis condimentum. Etiam massa quam, posuere eget nunc vel, viverra tincidunt elit. In sed scelerisque lectus. Praesent aliquam dolor at posuere condimentum. In tellus orci, convallis vitae leo eget, mollis feugiat dui. Nam vitae ligula ex.
</p>
<p>
Cras tortor ipsum, semper vitae viverra lobortis, ultricies convallis metus. Vestibulum at ex eget lorem viverra sollicitudin. Nunc consectetur et quam tincidunt hendrerit. Nullam porttitor eleifend tellus, porttitor semper massa venenatis ac. Pellentesque eget velit fringilla neque facilisis auctor at non lorem. Vestibulum eget venenatis arcu. Duis nibh augue, ultricies eget purus non, blandit luctus tellus. Sed ante risus, sagittis imperdiet ex quis, pellentesque blandit augue. Cras fermentum lobortis odio quis vestibulum. Pellentesque efficitur elementum urna, vitae malesuada leo accumsan elementum.
</p>
<p>
Curabitur finibus, nisi non luctus viverra, ipsum libero suscipit lectus, aliquam tincidunt neque enim sit amet sem. Cras quis porttitor urna. Proin ultrices magna vel neque pulvinar, ut iaculis lorem blandit. Phasellus vitae mi sed est luctus hendrerit. Donec et ultricies tortor. Donec interdum, sem a facilisis egestas, purus sapien vestibulum leo, ut congue risus massa sed orci. Duis tincidunt auctor metus, eget pharetra ligula rhoncus non. Proin in urna in tortor fringilla dapibus id in velit. Donec vulputate ut sem sed semper. Cras lacus elit, porta a commodo venenatis, iaculis et massa. Nunc aliquam congue lorem, eu pulvinar turpis consectetur at. Morbi fringilla placerat enim, non ornare mi mollis nec. Vivamus nec ultricies purus. Nullam dapibus erat non metus condimentum laoreet. Mauris sed libero viverra, efficitur enim dictum, laoreet nibh. Fusce in accumsan lacus.
</p>
<p>
Phasellus mollis egestas sapien, sit amet sodales ipsum placerat non. Nulla sit amet pellentesque libero, blandit tincidunt nisl. Mauris hendrerit libero a viverra lobortis. Nam eget mollis nunc, id suscipit eros. Morbi nec sem vel ipsum dignissim elementum. Nulla scelerisque justo et eleifend ultrices. Suspendisse imperdiet placerat ligula, vel dictum ligula tempus eget. Etiam massa velit, aliquam sit amet porta eu, varius in turpis. Pellentesque at dictum felis, et blandit risus. Sed vitae porta tellus. Donec egestas scelerisque dapibus.
</p>
<div class="close-btn">
<label for="contract-popup">
CLOSE POPUP
</label>
</div>
</div>
</div>
</div>
</div>
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
.popup-container {
display: inline-flex;
.button {
height: 40px;
line-height: 40px;
background: blue;
padding: 0 15px;
border-radius: 3px;
font-size: 14px;
color: #fff;
cursor: pointer;
}
.popup {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(#000,.5);
z-index: 10;
opacity: 0;
visibility: hidden;
transition: 400ms all;
>label {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
cursor: pointer;
}
.inner {
position: absolute;
top: 100%;
left: 50%;
transform: translate(-50%, -50%);
background: #fff;
min-width: 300px;
box-sizing: border-box;
transition: 400ms all;
z-index: 10;
max-height: 100%;
overflow: auto;
.title {
height: 40px;
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 15px;
position: sticky;
top: 0;
background: #fff;
h6 {
font-size: 15px;
font-weight: 500;
}
label {
font-size: 14px;
color: #999;
cursor: pointer;
&:hover {
color: #222;
}
}
}
.content {
padding: 5px 15px 15px;
ul {
li {
margin-bottom: 15px;
&:last-child {
margin-bottom: 0;
}
input {
width: 100%;
box-sizing: border-box;
border: none;
border-bottom: 1px solid #ddd;
padding-bottom: 10px;
font-size: 12px;
&:focus {
outline: 0;
border-color: blue;
}
}
button {
width: 100%;
height: 30px;
border-radius: 3px;
border: none;
background: blue;
color: #fff;
font-size: 13px;
cursor: pointer;
}
}
}
p {
font-size: 13px;
line-height: 130%;
margin-bottom: 15px;
&:last-child {
margin-bottom: 0;
}
}
.close-btn {
margin-top: 15px;
padding-top: 15px;
border-top: 1px solid #ddd;
label {
background: rgba(#000, .05);
display: block;
line-height: 30px;
text-align: center;
font-size: 13px;
color: #444;
border-radius: 3px;
cursor: pointer;
&:hover {
background: rgba(#000,.1);
}
}
}
}
}
}
>input {
position: absolute;
left: -9999px;
opacity: 0;
&:checked + .popup {
opacity: 1;
visibility: visible;
.inner {
top: 50%;
}
}
}
}
Also see: Tab Triggers