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="tabs-component">
<!-- tab titles -->
<ul class="tabs">
<li class="tab active" data-panel="#one">
<span class="title">Bitcoin</span>
</li>
<li class="tab" data-panel="#two">
<span class="title">Litecoin</span>
</li>
<li class="tab" data-panel="#three">
<span class="title">USDcoin</span>
</li>
<div class="slider"></div>
</ul>
<!--END tab titles -->
<!-- tab panels-->
<div class="panels">
<div id="one" class="panel show">
<div class="content">
<div class="content-img">
<img src="https://jssecrets.com/wp-content/uploads/2022/11/btc.png" />
</div>
<div class="content-title">Bitcoin</div>
<div class="content-paragraph">
Bitcoin is a decentralized digital currency, without a central
bank or single administrator, that can be sent from user to user
on the peer-to-peer bitcoin network without the need for
intermediaries.
</div>
</div>
</div>
<div id="two" class="panel">
<div class="content">
<div class="content-img">
<img src="https://jssecrets.com/wp-content/uploads/2022/11/ltc.png" />
</div>
<div class="content-title">Litecoin</div>
<div class="content-paragraph">
Litecoin is a peer-to-peer cryptocurrency and open-source software
project released under the MIT/X11 license. Litecoin was an early
bitcoin spinoff or altcoin, starting in October 2011. Supply limit
is 84,000,000 LTC
</div>
</div>
</div>
<div id="three" class="panel">
<div class="content">
<div class="content-img">
<img src="https://jssecrets.com/wp-content/uploads/2022/11/usd.png" />
</div>
<div class="content-title">USD Coin</div>
<div class="content-paragraph">
USD Coin is a digital stablecoin that is pegged to the United
States dollar. USD Coin is managed by a consortium called Centre,
which was founded by Circle including members from the Coinbase.
</div>
</div>
</div>
</div>
<div class="circle one"></div>
</div>
<!--END tab panels-->
<!-- made in jssecrets.com -->
<a class="jssecrets" href="https://jssecrets.com/" target="_blank"
>jssecrets.com</a
>
<!-- made in jssecrets.com -->
@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;800&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Urbanist:wght@500&display=swap");
*,
::before,
::after {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: "Poppins", sans-serif;
}
ul {
list-style: none;
}
body {
height: 100vh;
background: radial-gradient(circle, rgb(255, 255, 255) 70%, rgb(243, 243, 243) 100%);
position: relative;
display: flex;
justify-content: center;
align-items: center;
overflow: hidden;
color: #292d34;
}
.tabs-component {
margin-top: -40px;
width: 320px;
position: relative;
}
@media (max-width: 575.9px) {
.tabs-component {
width: 300px;
}
}
@media (max-width: 400px) {
.tabs-component {
width: 240px;
}
}
.tabs-component .tabs {
width: 100%;
display: flex;
justify-content: center;
align-items: center;
margin-bottom: 32px;
position: relative;
}
.tabs-component .tabs .slider {
position: absolute;
left: 0;
bottom: 0;
height: 100%;
width: 33.3333%;
background: linear-gradient(45deg, rgb(245, 205, 81) 0%, rgb(247, 206, 81) 100%);
box-shadow: 0 10px 25px rgba(245, 205, 81, 0.4);
border-radius: 9px;
z-index: 0;
transition: all 0.3s linear;
}
.tabs-component .tabs .tab {
width: 33.33333%;
height: 100%;
display: block;
text-align: center;
cursor: pointer;
padding: 16px 0 16px 0;
border-radius: 9px;
font-size: 16px;
z-index: 1;
position: relative;
color: #7c828d;
transition: all 0.3s linear;
}
.tabs-component .tabs .tab:hover {
color: #f7ce51;
}
.tabs-component .tabs .tab .title {
font-size: 16px;
}
.tabs-component .tabs .tab.active .title {
font-weight: 900;
color: white;
}
.tabs-component .tabs .tab:nth-of-type(1).active ~ .slider {
left: 0;
}
.tabs-component .tabs .tab:nth-of-type(2).active ~ .slider {
left: 33.33333%;
}
.tabs-component .tabs .tab:nth-of-type(3).active ~ .slider {
left: 66.66666%;
}
.tabs-component .panels .panel {
display: none;
height: 100%;
padding: 24px;
border-radius: 9px;
background: white;
box-shadow: 0 10px 25px rgba(124, 130, 141, 0.2);
background: rgba(255, 255, 255, 0.25);
backdrop-filter: blur(4px);
border: 1px solid rgba(255, 255, 255, 0.18);
}
.tabs-component .panels .panel .content-img {
margin-bottom: 16px;
}
.tabs-component .panels .panel .content-img img {
max-width: 100px;
vertical-align: middle;
}
@media (max-width: 575.9px) {
.tabs-component .panels .panel .content-img img {
max-width: 80px;
}
}
@media (max-width: 575.9px) {
.tabs-component .panels .panel .content-img {
margin-bottom: 12px;
}
}
.tabs-component .panels .panel .content-title {
font-size: 20px;
font-weight: 900;
margin-bottom: 16px;
color: #292d34;
}
@media (max-width: 575.9px) {
.tabs-component .panels .panel .content-title {
font-size: 16px;
margin-bottom: 12px;
}
}
.tabs-component .panels .panel .content-paragraph {
font-size: 16px;
font-weight: 400;
color: #7c828d;
}
@media (max-width: 575.9px) {
.tabs-component .panels .panel .content-paragraph {
font-size: 14px;
}
}
.tabs-component .panels .panel.show {
display: block;
}
.tabs-component .panels .panel.show .content-img {
animation: toLeft 1s ease-out 0s both;
}
.tabs-component .panels .panel.show .content-title {
animation: toLeft 1s ease-out 0.075s both;
}
.tabs-component .panels .panel.show .content-paragraph {
animation: toLeft 1s ease-out 0.15s both;
}
@keyframes toLeft {
from {
transform: translateX(100px);
opacity: 0;
}
to {
transform: translateX(0px);
opacity: 1;
}
}
.circle {
position: absolute;
border-radius: 100%;
opacity: 0.7;
filter: blur(0px);
}
@media (max-width: 400px) {
.circle {
display: none;
}
}
.circle.one {
width: 200px;
height: 200px;
background: linear-gradient(45deg, rgb(245, 205, 81) 0%, rgb(247, 206, 81) 100%);
bottom: -80px;
right: -80px;
z-index: -1;
box-shadow: 0 10px 25px rgba(245, 205, 81, 0.4);
background: radial-gradient(circle at 100px 100px, #f7ce51, #f5cd51);
}
@media (max-width: 575.9px) {
.circle.one {
width: 100px;
height: 100px;
bottom: -40px;
right: -40px;
}
}
.jssecrets {
font-weight: 500;
text-decoration: none !important;
font-family: "Urbanist";
padding: 16px;
background: #ffc805;
color: #000000;
font-size: 1.2em;
letter-spacing: 0.2px;
border-radius: 8px;
box-shadow: 0px 4px 12px rgba(184, 144, 0, 0.1882352941), 0px 8px 24px rgba(184, 144, 0, 0.3764705882);
position: absolute;
bottom: 24px;
right: 24px;
transition: all 0.3s;
}
.jssecrets:hover {
transform: translateY(-4px);
}
// Variables
const tabs = document.querySelectorAll('.tab');
// Functions
const changeTab = (event) => {
// remove class ".active" from the current active tab
document.querySelector('.active').classList.remove('active');
// add class ".active" to the clicked tab
event.currentTarget.classList.add('active');
// remove class ".show" from the current active panel
document.querySelector('.show').classList.remove('show');
// add class ".show" to the corresponding new active's tab panel
document
.querySelector(event.currentTarget.dataset.panel)
.classList.add('show');
};
// Event Listeners
tabs.forEach((tab) => {
tab.addEventListener('click', changeTab);
});
Also see: Tab Triggers