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 URL's added here will be added as <link>
s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.
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.
If the stylesheet 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 CSS 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.
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 Skypack, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ES6 import
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.
<!-- Source YouTube: https://www.youtube.com/watch?v=22d-sC_dhRY -->
<div class="container" id="container">
<div class="circle-container">
<div class="circle">
<button id="close">
<i class="fas fa-times"></i>
</button>
<button id="open">
<i class="fas fa-bars"></i>
</button>
</div>
</div>
<div class="content">
<h1>Amazing Article</h1>
<small>by Florin Pop 🤪</small>
<p>Lorem, ipsum dolor sit amet consectetur adipisicing elit. Exercitationem facilis distinctio nisi! Vel eius ab sequi repellendus reiciendis voluptatum id qui dolores earum incidunt nulla, molestias quam quidem dicta odit fuga ratione provident natus quibusdam dolor labore est. Illum nisi voluptatem esse nostrum ipsa accusamus perspiciatis vel quaerat labore in natus voluptatum, sequi harum libero, et cumque nesciunt reiciendis voluptates laudantium deserunt. Placeat aliquid neque commodi nostrum necessitatibus? Accusamus ullam vel ea nesciunt sint suscipit laboriosam eos saepe ducimus quo, nam perspiciatis exercitationem laborum deleniti facilis pariatur minima rem maiores neque fugiat quae rerum, recusandae soluta magni. Praesentium, sed nostrum?</p>
<p>Illum error officiis voluptate maiores consequatur, ad, ducimus magni impedit libero officia dolorum eum nesciunt doloribus exercitationem sunt pariatur excepturi adipisci cumque natus rem tempora accusamus rerum velit sequi. Tempora magni quasi sunt placeat officia rem porro repudiandae optio corrupti aut quam nihil inventore sit, totam quibusdam dolorem, minus eius, expedita architecto quisquam vero pariatur incidunt. Officiis libero exercitationem eveniet modi. Quos enim quasi sit praesentium aut minima maiores doloremque odio magnam culpa, magni cupiditate harum dolorum. Necessitatibus qui rerum consequatur officia amet, aspernatur officiis tempora labore ab. Error, eum asperiores! Consequatur deserunt dolorem aut accusamus cum eius rerum veniam?</p>
<h3>Look a cute doggie! 🥰</h3>
<img src="https://images.unsplash.com/photo-1507146426996-ef05306b995a?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=2100&q=80" alt="doggy" />
<p>Maiores, necessitatibus! Deserunt culpa ullam repudiandae pariatur nisi qui veniam nobis, consectetur iste laudantium modi dolores totam quos ratione ipsum aspernatur iure optio? Itaque tenetur nemo aspernatur eveniet maiores, laudantium sequi odio repellat perferendis voluptas. Necessitatibus impedit esse aliquid vero aut quibusdam, culpa iste delectus consectetur quasi cumque, iure distinctio blanditiis, adipisci voluptatum veniam. Maxime iste illo praesentium natus ex? Sapiente dicta rerum dignissimos omnis porro obcaecati quidem fugit. Sit commodi dolor doloribus distinctio odit quaerat possimus asperiores provident aliquam! Magni laboriosam quo quisquam earum accusamus fuga aut tempore labore quos dolorum nobis fugiat cupiditate alias sit, quasi numquam deserunt!</p>
</div>
</div>
<!-- Nav has to be after .container -->
<nav>
<ul>
<li><i class="fas fa-home"></i> Home</li>
<li><i class="fas fa-user-alt"></i> About</li>
<li><i class="fas fa-envelope"></i> Contact</li>
</ul>
</nav>
<!-- SOCIAL PANEL HTML -->
<div class="social-panel-container">
<div class="social-panel">
<p>Created with <i class="fa fa-heart"></i> by
<a target="_blank" href="https://florin-pop.com">Florin Pop</a></p>
<button class="close-btn"><i class="fas fa-times"></i></button>
<h4>Get in touch on</h4>
<ul>
<li>
<a href="https://www.patreon.com/florinpop17" target="_blank">
<i class="fab fa-discord"></i>
</a>
</li>
<li>
<a href="https://twitter.com/florinpop1705" target="_blank">
<i class="fab fa-twitter"></i>
</a>
</li>
<li>
<a href="https://linkedin.com/in/florinpop17" target="_blank">
<i class="fab fa-linkedin"></i>
</a>
</li>
<li>
<a href="https://facebook.com/florinpop17" target="_blank">
<i class="fab fa-facebook"></i>
</a>
</li>
<li>
<a href="https://instagram.com/florinpop17" target="_blank">
<i class="fab fa-instagram"></i>
</a>
</li>
</ul>
</div>
</div>
<button class="floating-btn">
Get in Touch
</button>
<div class="floating-text">
Part of <a href="https://florin-pop.com/blog/2019/09/100-days-100-projects" target="_blank">#100Days100Projects</a>
</div>
@import url('https://fonts.googleapis.com/css?family=Muli&display=swap');
@import url('https://fonts.googleapis.com/css?family=Lato&display=swap');
* {
box-sizing: border-box;
}
body {
background-color: #333;
color: #222;
font-family: 'Lato', sans-serif;
margin: 0;
overflow-x: hidden;
}
.container {
background-color: #fafafa;
transform-origin: top left;
transition: transform 0.5s linear;
padding: 50px;
width: 100vw;
min-height: 100vh;
}
.circle-container {
position: fixed;
top: -100px;
left: -100px;
}
.container.show-nav {
transform: rotate(-20deg);
}
.circle {
background-color: #ff7979;
border-radius: 50%;
position: relative;
height: 200px;
width: 200px;
transition: transform 0.5s linear;
}
.container.show-nav .circle {
transform: rotate(-70deg);
}
.circle button {
background: transparent;
border: 0;
color: #fff;
font-size: 26px;
position: absolute;
top: 50%;
left: 50%;
height: 100px;
}
.circle button:focus {
outline: none;
}
.circle button#open {
left: 60%;
}
.circle button#close {
top: 60%;
transform: rotate(90deg);
transform-origin: top left;
}
nav {
color: #fff;
position: fixed;
bottom: 40px;
left: 0;
z-index: 100;
}
nav ul {
list-style-type: none;
padding-left: 30px;
}
nav ul li {
margin: 40px 0;
text-transform: uppercase;
transform: translateX(-100%);
transition: transform 0.4s cubic-bezier(.28,.27,.65,1.25);
transition-delay: 0s;
}
.container.show-nav + nav li {
transform: translateX(0);
transition-delay: 0.3s;
}
nav ul li i {
font-size: 20px;
margin-right: 10px;
}
nav ul li + li {
margin-left: 15px;
transform: translateX(-150%);
}
nav ul li + li + li {
margin-left: 30px;
transform: translateX(-200%);
}
.content {
max-width: 1000px;
margin: 50px auto;
}
.content h1 {
margin: 0;
}
.content small {
color: #555;
font-style: italic;
}
.content p {
color: #333;
line-height: 1.5;
}
.content img {
max-width: 100%;
}
/* SOCIAL PANEL CSS */
.social-panel-container {
position: fixed;
right: 0;
bottom: 80px;
transform: translateX(100%);
transition: transform 0.4s ease-in-out;
}
.social-panel-container.visible {
transform: translateX(-10px);
}
.social-panel {
background-color: #fff;
border-radius: 16px;
box-shadow: 0 16px 31px -17px rgba(0,31,97,0.6);
border: 5px solid #001F61;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
font-family: 'Muli';
position: relative;
height: 169px;
width: 370px;
max-width: calc(100% - 10px);
}
.social-panel button.close-btn {
border: 0;
color: #97A5CE;
cursor: pointer;
font-size: 20px;
position: absolute;
top: 5px;
right: 5px;
}
.social-panel button.close-btn:focus {
outline: none;
}
.social-panel p {
background-color: #001F61;
border-radius: 0 0 10px 10px;
color: #fff;
font-size: 14px;
line-height: 18px;
padding: 2px 17px 6px;
position: absolute;
top: 0;
left: 50%;
margin: 0;
transform: translateX(-50%);
text-align: center;
width: 235px;
}
.social-panel p i {
margin: 0 5px;
}
.social-panel p a {
color: #FF7500;
text-decoration: none;
}
.social-panel h4 {
margin: 20px 0;
color: #97A5CE;
font-family: 'Muli';
font-size: 14px;
line-height: 18px;
text-transform: uppercase;
}
.social-panel ul {
display: flex;
list-style-type: none;
padding: 0;
margin: 0;
}
.social-panel ul li {
margin: 0 10px;
}
.social-panel ul li a {
border: 1px solid #DCE1F2;
border-radius: 50%;
color: #001F61;
font-size: 20px;
display: flex;
justify-content: center;
align-items: center;
height: 50px;
width: 50px;
text-decoration: none;
}
.social-panel ul li a:hover {
border-color: #FF6A00;
box-shadow: 0 9px 12px -9px #FF6A00;
}
.floating-btn {
border-radius: 26.5px;
background-color: #001F61;
border: 1px solid #001F61;
box-shadow: 0 16px 22px -17px #03153B;
color: #fff;
cursor: pointer;
font-size: 16px;
line-height: 20px;
padding: 12px 20px;
position: fixed;
bottom: 20px;
right: 20px;
z-index: 999;
}
.floating-btn:hover {
background-color: #ffffff;
color: #001F61;
}
.floating-btn:focus {
outline: none;
}
.floating-text {
background-color: #001F61;
border-radius: 10px 10px 0 0;
color: #fff;
font-family: 'Muli';
padding: 7px 15px;
position: fixed;
bottom: 0;
left: 50%;
transform: translateX(-50%);
text-align: center;
z-index: 998;
}
.floating-text a {
color: #FF7500;
text-decoration: none;
}
@media screen and (max-width: 480px) {
.social-panel-container.visible {
transform: translateX(0px);
}
.floating-btn {
right: 10px;
}
}
const open = document.getElementById('open');
const close = document.getElementById('close');
const container = document.getElementById('container');
open.addEventListener('click', () => {
container.classList.add('show-nav');
});
close.addEventListener('click', () => {
container.classList.remove('show-nav');
});
// SOCIAL PANEL JS
const floating_btn = document.querySelector('.floating-btn');
const close_btn = document.querySelector('.close-btn');
const social_panel_container = document.querySelector('.social-panel-container');
floating_btn.addEventListener('click', () => {
social_panel_container.classList.toggle('visible')
});
close_btn.addEventListener('click', () => {
social_panel_container.classList.remove('visible')
});
Also see: Tab Triggers