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.
<!-- Begin .site-wrapper -->
<div class="site-wrapper">
<!-- Begin Header -->
<header>
<h1>Macaw Power Tabs - Macaw Tabs Plugin</h1>
<p>Accessible, Responsive & Friendly Tabs</p>
<hr>
<ul>
<li>Use <kbd>Arrow</kbd> keys to navigate tabs.</li>
<li>Display tab panel by pressing <kbd>Space</kbd> or <kbd>Enter</kbd>.</li>
</ul>
</header>
<!-- End Header -->
<!-- Begin Main -->
<main>
<!-- Begin .macaw-tabs -->
<div class="macaw-tabs macaw-power-tabs">
<div role="tablist" aria-label="Company">
<button role="tab" aria-selected="true" aria-controls="home-tab" id="home"><span class="material-icons icon">home</span> <span class="label">Home</span></button>
<button role="tab" aria-selected="false" aria-controls="news-tab" id="news" tabindex="-1"><span class="material-icons icon">settings_input_hdmi</span> <span class="label">News</span></button>
<button role="tab" aria-selected="false" aria-controls="gallery-tab" id="gallery" tabindex="-1"><span class="material-icons icon">theaters</span> <span class="label">Gallery</span></button>
<button role="tab" aria-selected="false" aria-controls="contact-tab" id="contact" tabindex="-1"><span class="material-icons icon">send</span> <span class="label">Contact</span></button>
</div>
<div tabindex="0" role="tabpanel" aria-labelledby="home" id="home-tab">
<p>Vestibulum vitae <a href="#">feugiat quam</a>, eget porttitor lacus. Praesent blandit gravida neque at vestibulum. Nullam congue mauris massa, sit amet mattis leo fringilla nec. Quisque accumsan scelerisque leo eu laoreet. Aliquam libero tortor.</p>
<p>Cras volutpat diam quis odio cursus accumsan. Ut tincidunt cursus sagittis. Sed lobortis luctus interdum. Proin placerat, augue non placerat egestas, mi ante sagittis nulla, vitae auctor lectus sem varius nunc. Quisque at elit non nisl molestie consectetur. Vestibulum at accumsan diam. Sed eget cursus ipsum, in sagittis arcu. Nulla dolor dolor.</p>
</div>
<div tabindex="0" role="tabpanel" aria-labelledby="news" id="news-tab" hidden>
<p>Nullam est ipsum, vestibulum non ullamcorper vitae, <a href="#">volutpat vitae enim</a>. Donec ligula libero, sodales faucibus mauris ut, aliquet interdum sem. Pellentesque fermentum mi dignissim dui rhoncus pellentesque. Quisque blandit eros vel purus suscipit, sit amet aliquet leo lobortis.</p>
<p>Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Ut ullamcorper tempor lacinia. Nunc commodo elit eu feugiat bibendum. Curabitur et dapibus libero. Vestibulum at accumsan diam. Sed eget cursus ipsum, in sagittis arcu. Nulla dolor dolor.</p>
</div>
<div tabindex="0" role="tabpanel" aria-labelledby="gallery" id="gallery-tab" hidden>
<p>Sed euismod arcu tincidunt metus dapibus ultrices. Morbi varius imperdiet tortor sit amet imperdiet. <a href="#">Donec at lacinia mi</a>. Suspendisse eget malesuada turpis. Duis sit amet velit neque. Mauris in elit purus. In nulla dui, pretium vitae feugiat a, luctus sit amet metus.</p>
<p>Ut eget consequat augue. Aenean consectetur, diam congue viverra lobortis, velit felis molestie nulla, at iaculis mi quam ut enim. Fusce in mattis ante, a ultricies lacus. Nunc vulputate consequat tellus ut convallis. Nullam vulputate pharetra dignissim. Praesent nec posuere nisl. Sed sollicitudin et nunc nec bibendum.</p>
</div>
<div tabindex="0" role="tabpanel" aria-labelledby="contact" id="contact-tab" hidden>
<p>Mauris semper ac <a href="#">libero ut blandit</a>. Vestibulum nec magna a tortor sodales sagittis sit amet nec lectus. Duis egestas ullamcorper nunc, vel sodales elit vestibulum non. Morbi interdum viverra elit non pharetra. Cras diam ligula, maximus in venenatis eu, varius ac urna. Fusce suscipit gravida diam, nec molestie mi facilisis eget.</p>
<p>Ut placerat malesuada libero fringilla elementum. Etiam finibus sollicitudin nisl, quis faucibus mauris pellentesque at. Morbi condimentum quis arcu nec rhoncus. Aliquam ultricies justo sed nulla efficitur, ac pulvinar neque commodo. Aenean ac commodo mauris, eget feugiat enim.</p>
</div>
</div>
<!-- End .macaw-tabs -->
</main>
<!-- End Main -->
<!-- Begin Footer -->
<footer>
<span><a href="https://htmlcssfreebies.com/macaw-power-tabs/" target="_blank">Macaw Power Tabs</a> by HTMLCSSFreebies</span>
<span>Powered by <a href="https://htmlcssfreebies.com/macaw-tabs/" target="_blank">Macaw Tabs</a>
</footer>
<!-- End Footer -->
</div>
<!-- End .site-wrapper -->
/**
* Macaw Tabs | Tabs jQuery Plugin
*
* @author https://htmlcssfreebies.com/macaw-tabs/
* @copyright Copyright (c) 2021 HTMLCSSFreebies.com
* @license MIT License, https://opensource.org/licenses/MIT
* @version v1.0.0
*/
/*
--------
* Macaw Tabs Plugin
* Theme: Macaw Power Tabs
--------
*/
.macaw-tabs.macaw-power-tabs {
/*
--------
* Color Palette
--------
*/
--tab-color-white: #fff;
--tab-color-black: #000;
--tab-color-turquoise: #34cfc9;
--tab-color-green: #218380;
--tab-color-skobeloff: #1a6966;
--tab-color-gray: #b7b5b3;
/*
--------
* CSS Vars
--------
*/
--tab-bg-color: transparent;
--tab-text-color: var(--tab-color-black);
--tab-border-color: var(--tab-color-gray);
--tab-active-bg-color: var(--tab-color-green);
--tab-active-text-color: var(--tab-color-white);
--tab-active-secondary-text-color: var(--tab-color-black);
--tab-active-border-color: var(--tab-color-green);
--tab-focus-border-color: var(--tab-color-skobeloff);
--tab-icon-color: var(--tab-color-turquoise);
--tab-icon-secondary-color: var(--tab-color-white);
/*
--------
* Style
--------
*/
margin-left: auto;
margin-right: auto;
width: 100%;
max-width: 750px;
}
.macaw-tabs.macaw-power-tabs > [role="tablist"] {
position: relative;
z-index: 3;
display: flex;
gap: 1.25rem;
}
.macaw-tabs.macaw-power-tabs > [role="tablist"] > * {
border: none;
}
.macaw-tabs.macaw-power-tabs > [role="tablist"] > [role="tab"] {
position: relative;
margin: 0;
overflow: visible;
word-wrap: break-word;
font-family: var(--global-heading-font-family);
font-size: 1rem;
font-weight: normal;
line-height: 1.625;
display: flex;
align-items: center;
justify-content: center;
text-align: center;
background-color: var(--tab-bg-color);
color: var(--tab-text-color);
border: none;
border-bottom: 3px solid var(--tab-border-color);
padding: 0.625rem;
transition: background-color 0.2s;
}
.macaw-tabs.macaw-power-tabs > [role="tablist"] > [role="tab"] .icon {
color: var(--tab-icon-color);
}
.macaw-tabs.macaw-power-tabs > [role="tablist"] > [role="tab"] > * {
padding: 0;
padding-right: 0.375rem;
}
.macaw-tabs.macaw-power-tabs > [role="tablist"] > [role="tab"] > *:last-child {
padding-right: 0;
}
.macaw-tabs.macaw-power-tabs > [role="tablist"] > [role="tab"]:hover,
.macaw-tabs.macaw-power-tabs > [role="tablist"] > [role="tab"]:focus {
outline: 0;
border-color: var(--tab-focus-border-color);
}
.macaw-tabs.macaw-power-tabs
> [role="tablist"]
> [role="tab"][aria-selected="true"] {
background-color: var(--tab-active-bg-color);
color: var(--tab-active-text-color);
border: none;
border-bottom: 3px solid var(--tab-active-border-color);
}
.macaw-tabs.macaw-power-tabs
> [role="tablist"]
> [role="tab"][aria-selected="true"]
.icon {
color: var(--tab-icon-secondary-color);
}
.macaw-tabs.macaw-power-tabs
> [role="tablist"]
> [role="tab"][aria-selected="true"]:hover,
.macaw-tabs.macaw-power-tabs
> [role="tablist"]
> [role="tab"][aria-selected="true"]:focus {
outline: 0;
border-color: var(--tab-focus-border-color);
}
.macaw-tabs.macaw-power-tabs > [role="tablist"] > [role="tab"]:hover,
.macaw-tabs.macaw-power-tabs > [role="tablist"] > [role="tab"]:focus,
.macaw-tabs.macaw-power-tabs > [role="tablist"] > [role="tab"]:active {
outline: 0;
}
.macaw-tabs.macaw-power-tabs > [role="tabpanel"] {
position: relative;
z-index: 2;
font-family: var(--global-body-font-family);
font-weight: normal;
font-size: 1rem;
line-height: 1.625;
padding: 0.625rem 0;
background-color: var(--tab-bg-color);
color: var(--tab-active-secondary-text-color);
border-bottom: 3px solid var(--tab-bg-color);
}
.macaw-tabs.macaw-power-tabs > [role="tabpanel"] a,
.macaw-tabs.macaw-power-tabs > [role="tabpanel"] a:visited {
cursor: pointer;
color: inherit;
-webkit-text-decoration-style: dotted;
text-decoration-style: dotted;
text-underline-offset: 0.1875rem;
}
.macaw-tabs.macaw-power-tabs > [role="tabpanel"] a:hover {
text-decoration: none;
}
.macaw-tabs.macaw-power-tabs > [role="tabpanel"] > * {
margin-top: 24px;
margin-bottom: 24px;
opacity: 0;
transform: translateY(20px);
transition: opacity 0.2s, transform 0.2s;
}
.macaw-tabs.macaw-power-tabs > [role="tabpanel"] > *:first-child {
margin-top: 0;
}
.macaw-tabs.macaw-power-tabs > [role="tabpanel"] > *:last-child {
margin-bottom: 0;
}
.macaw-tabs.macaw-power-tabs > [role="tabpanel"] > *:nth-child(1) {
transition-delay: 0.2s;
}
.macaw-tabs.macaw-power-tabs > [role="tabpanel"] > *:nth-child(2) {
transition-delay: 0.3s;
}
.macaw-tabs.macaw-power-tabs > [role="tabpanel"] > *:nth-child(3) {
transition-delay: 0.4s;
}
.macaw-tabs.macaw-power-tabs > [role="tabpanel"] > *:nth-child(4) {
transition-delay: 0.5s;
}
.macaw-tabs.macaw-power-tabs > [role="tabpanel"] > *:nth-child(5) {
transition-delay: 0.6s;
}
.macaw-tabs.macaw-power-tabs > [role="tabpanel"] > *:nth-child(6) {
transition-delay: 0.7s;
}
.macaw-tabs.macaw-power-tabs > [role="tabpanel"] > *:nth-child(7) {
transition-delay: 0.8s;
}
.macaw-tabs.macaw-power-tabs > [role="tabpanel"] > *:nth-child(8) {
transition-delay: 0.9s;
}
.macaw-tabs.macaw-power-tabs > [role="tabpanel"] > *:nth-child(9) {
transition-delay: 1s;
}
.macaw-tabs.macaw-power-tabs > [role="tabpanel"] > *:nth-child(10) {
transition-delay: 1.1s;
}
.macaw-tabs.macaw-power-tabs > [role="tabpanel"] > *:nth-child(11) {
transition-delay: 1.2s;
}
.macaw-tabs.macaw-power-tabs > [role="tabpanel"] > *:nth-child(12) {
transition-delay: 1.3s;
}
.macaw-tabs.macaw-power-tabs > [role="tabpanel"] > *:nth-child(13) {
transition-delay: 1.4s;
}
.macaw-tabs.macaw-power-tabs > [role="tabpanel"] > *:nth-child(14) {
transition-delay: 1.5s;
}
.macaw-tabs.macaw-power-tabs > [role="tabpanel"] > *:nth-child(15) {
transition-delay: 1.6s;
}
.macaw-tabs.macaw-power-tabs > [role="tabpanel"] > *:nth-child(16) {
transition-delay: 1.7s;
}
.macaw-tabs.macaw-power-tabs > [role="tabpanel"] > *:nth-child(17) {
transition-delay: 1.8s;
}
.macaw-tabs.macaw-power-tabs > [role="tabpanel"] > *:nth-child(18) {
transition-delay: 1.9s;
}
.macaw-tabs.macaw-power-tabs > [role="tabpanel"] > *:nth-child(19) {
transition-delay: 2s;
}
.macaw-tabs.macaw-power-tabs > [role="tabpanel"] > *:nth-child(20) {
transition-delay: 2.1s;
}
.macaw-tabs.macaw-power-tabs > [role="tabpanel"].active > * {
opacity: 1;
transform: translateY(0);
}
.macaw-tabs.macaw-power-tabs > [role="tabpanel"]:focus {
outline: 0;
border-bottom: 3px solid var(--tab-focus-border-color);
}
/*
--------
* Media Queries
--------
*/
@media only screen and (min-width: 768px) {
.macaw-tabs.macaw-power-tabs > [role="tablist"] > [role="tab"] {
font-size: 1.125rem;
line-height: 1.8333333333;
padding: 0.9375rem 1.25rem;
}
.macaw-tabs.macaw-power-tabs > [role="tabpanel"] {
font-size: 1.125rem;
line-height: 1.8333333333;
padding: 1.25rem 0;
}
}
@media only screen and (min-width: 1280px) {
.macaw-tabs.macaw-power-tabs {
max-width: 850px;
}
}
@media only screen and (max-width: 575px) {
.macaw-tabs.macaw-power-tabs.vertical {
display: flex;
width: 100%;
}
.macaw-tabs.macaw-power-tabs.vertical > [role="tablist"] {
width: 15%;
flex-direction: column;
}
.macaw-tabs.macaw-power-tabs.vertical > [role="tablist"] > * {
border: none;
border-bottom: 1px solid var(--tab-border-color);
}
.macaw-tabs.macaw-power-tabs.vertical > [role="tablist"] > *:last-child {
border-bottom: none;
}
.macaw-tabs.macaw-power-tabs.vertical > [role="tablist"] > [role="tab"] {
border: none;
border-right: 3px solid var(--tab-border-color);
}
.macaw-tabs.macaw-power-tabs.vertical
> [role="tablist"]
> [role="tab"]
.icon {
font-size: 1.375rem;
line-height: 1;
}
.macaw-tabs.macaw-power-tabs.vertical
> [role="tablist"]
> [role="tab"]
.label {
display: none;
}
.macaw-tabs.macaw-power-tabs.vertical > [role="tablist"] > [role="tab"] > * {
padding: 0;
}
.macaw-tabs.macaw-power-tabs.vertical > [role="tablist"] > [role="tab"]:hover,
.macaw-tabs.macaw-power-tabs.vertical
> [role="tablist"]
> [role="tab"]:focus {
border-color: var(--tab-focus-border-color);
}
.macaw-tabs.macaw-power-tabs.vertical
> [role="tablist"]
> [role="tab"][aria-selected="true"] {
border: none;
border-right: 3px solid var(--tab-active-border-color);
}
.macaw-tabs.macaw-power-tabs.vertical
> [role="tablist"]
> [role="tab"][aria-selected="true"]:hover,
.macaw-tabs.macaw-power-tabs.vertical
> [role="tablist"]
> [role="tab"][aria-selected="true"]:focus {
outline: 0;
border-color: var(--tab-focus-border-color);
}
.macaw-tabs.macaw-power-tabs.vertical > [role="tabpanel"] {
width: 85%;
padding: 0 0.9375rem;
}
}
$(document).ready(function () {
$(".macaw-tabs").macawTabs();
});
Also see: Tab Triggers