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="mt-accordion" style="display: none;">
<div class="mt-accordion-item">
<div class="mt-accordion-item-header">
<div class="mt-accordion-item-header__title-container">
<div class="mt-accordion-title-container-logo">
<h3 style="display: none;">Fashion Pay</h3>
<svg class="mt-accordion-title-container-logo__svg" fill="none" height="24" role="img" title="Fashion Pay" viewbox="0 0 96 24" width="96" xmlns="http://www.w3.org/2000/svg">
<rect fill="url(#paint0_linear_2065_3289)" height="24" rx="2" width="96"></rect>
<path d="M85.0939 16.0528V12.737L81.6117 8.29004H82.5211L85.4709 12.0384L88.4208 8.29004H89.3301L85.848 12.737V16.0528H85.0939Z" fill="black"></path>
<path d="M77.6203 9.63216L75.7351 13.3029H79.5056L77.6203 9.63216ZM73.5282 16.0531L77.6203 8.15723L81.7124 16.0531H80.9029L79.8493 14.0015H75.3913L74.3377 16.0531H73.5282Z" fill="black"></path>
<path d="M67.1156 16.0528V8.29004H69.8991C71.862 8.29004 72.8933 9.28811 72.8933 10.6521C72.8933 12.0162 71.862 13.0143 69.8991 13.0143H67.8697V16.0528H67.1156ZM67.8697 12.3156H69.8215C71.4184 12.3156 72.1281 11.628 72.1281 10.6521C72.1281 9.68734 71.4184 8.98869 69.8215 8.98869H67.8697V12.3156Z" fill="black"></path>
<path d="M59.693 12.8484V8.2905H61.2344V16.2862L55.745 11.4954V16.0533H54.2036V8.05762L59.693 12.8484Z" fill="black"></path>
<path d="M48.0632 16.1862C45.7898 16.1862 43.9933 14.4229 43.9933 12.1717C43.9933 9.92049 45.7898 8.15723 48.0632 8.15723C50.3144 8.15723 52.122 9.92049 52.122 12.1717C52.122 14.4229 50.3144 16.1862 48.0632 16.1862ZM45.568 12.1717C45.568 13.569 46.6215 14.7112 48.0632 14.7112C49.516 14.7112 50.5473 13.569 50.5473 12.1717C50.5473 10.7744 49.516 9.63216 48.0632 9.63216C46.6215 9.63216 45.568 10.7744 45.568 12.1717Z" fill="black"></path>
<path d="M40.3757 8.29004H41.9171V16.0528H40.3757V8.29004Z" fill="black"></path>
<path d="M30.9545 16.0528V8.29004H32.496V11.3841H36.3552V8.29004H37.8967V16.0528H36.3552V12.8368H32.496V16.0528H30.9545Z" fill="black"></path>
<path d="M25.795 16.1862C24.4864 16.1862 23.4218 15.5873 23.0336 15.2436V13.5579C23.3774 13.9017 24.5751 14.7667 25.795 14.7667C26.8596 14.7667 27.3032 14.312 27.3032 13.8352C27.3032 13.4359 27.0925 13.1698 26.1831 12.9147L25.1629 12.6375C23.4883 12.1717 22.9227 11.462 22.9227 10.4306C22.9227 9.05549 24.2868 8.15723 25.9502 8.15723C27.037 8.15723 27.9575 8.54537 28.4454 8.91133V10.5859C28.0018 10.1645 27.037 9.57671 25.9946 9.57671C25.1407 9.57671 24.5086 9.87613 24.5086 10.3419C24.5086 10.7744 24.8856 10.974 25.7506 11.2069L26.7598 11.4841C28.3789 11.9388 28.889 12.7151 28.889 13.7686C28.889 15.055 27.7135 16.1862 25.795 16.1862Z" fill="black"></path>
<path d="M17.4367 10.9409L16.4497 12.8927H18.4126L17.4367 10.9409ZM13.2891 16.0533L17.4367 8.05762L21.5842 16.0533H19.9208L19.0336 14.3455H15.8287L14.9526 16.0533H13.2891Z" fill="black"></path>
<path d="M6.51428 16.0528V8.29004H12.6247V9.74279H8.05575V11.4506H12.1811L11.3143 12.9034H8.05575V16.0528H6.51428Z" fill="black"></path>
<defs>
<lineargradient gradientunits="userSpaceOnUse" id="paint0_linear_2065_3289" x1="0" x2="35.6339" y1="0" y2="36.1796">
<stop stop-color="#3CF1FD"></stop>
<stop offset="1" stop-color="#94FFEC"></stop>
</lineargradient>
</defs>
</svg>
<p>Spread the cost</p>
</div>
<p>24.9% APR Representative variable</p>
</div>
<div class="chevron">
<svg role="img" title="Chevron" xmlns="http://www.w3.org/2000/svg" width="12" height="20" viewBox="0 0 12 20" fill="none">
<g clip-path="url(#clip0_2118_1157)">
<path fill-rule="evenodd" clip-rule="evenodd" d="M5.9913 13C5.8703 13 5.7503 12.957 5.6543 12.87L0.163303 7.87C-0.0406965 7.684 -0.0556965 7.367 0.130303 7.163C0.316303 6.959 0.633304 6.945 0.837304 7.13L5.9923 11.824L11.1643 7.13C11.3683 6.945 11.6843 6.96 11.8703 7.164C12.0553 7.368 12.0403 7.685 11.8363 7.87L6.3273 12.87C6.2323 12.957 6.1113 13 5.9913 13Z" fill="black" />
</g>
<defs>
<clipPath id="clip0_2118_1157">
<rect width="11.9998" height="20" fill="white" />
</clipPath>
</defs>
</svg>
</div>
</div>
<div class="mt-accordion-item-body">
<div class="mt-accordion-item-body-content">
<p class="mt-accordion-item-body-content__credit-message">Credit Account ^</p>
<div class="mt-accordion-item-body-content__inner-container">
<h4 class="mt-accordion-item-body-content-inner-container__title">Proceed without impacting your credit score<span>±</span></h4>
<p class="mt-accordion-item-body-content-inner-container__message">By clicking ‘Check My Eligibility’ you are agreeing with our <a class="mt-accordion-item-body-content-inner-container-terms" href="/terms">Terms and Conditions</a> and <a class="mt-accordion-item-body-content-inner-container-privacy" href="/privacy">Privacy Policy and Cookie Policy</a>.</p>
</div>
<button class="mt-accordion-item-body-content__cta-btn">Check My Eligiblity</button>
</div>
</div>
</div>
<div class="mt-accordion-cta-pop-up"><svg class="mt-accordion-cta-pop-up__chevron" fill="none" height="16" role="img" title="chevron" viewbox="0 0 32 16" width="32" xmlns="http://www.w3.org/2000/svg">
<path d="M32 16L16 0L0 16H32Z" fill="white"></path>
</svg> <svg class="mt-accordion-cta-pop-up__close" fill="none" height="12" role="img" title="close icon" viewbox="0 0 12 12" width="12" xmlns="http://www.w3.org/2000/svg">
<path clip-rule="evenodd" d="M6.70725 6.00025L11.8533 0.85425C12.0493 0.65825 12.0493 0.34225 11.8533 0.14625C11.6583 -0.04875 11.3422 -0.04875 11.1462 0.14625L6.00025 5.29325L0.853251 0.14625C0.658251 -0.04875 0.34225 -0.04875 0.14625 0.14625C-0.04875 0.34225 -0.04875 0.65825 0.14625 0.85425L5.29325 6.00025L0.14625 11.1462C-0.04875 11.3422 -0.04875 11.6582 0.14625 11.8542C0.24425 11.9513 0.37225 12.0002 0.50025 12.0002C0.62825 12.0002 0.756251 11.9513 0.853251 11.8542L6.00025 6.70725L11.1462 11.8542C11.2442 11.9513 11.3722 12.0002 11.5002 12.0002C11.6283 12.0002 11.7563 11.9513 11.8533 11.8542C12.0493 11.6582 12.0493 11.3422 11.8533 11.1462L6.70725 6.00025Z" fill="black" fill-rule="evenodd"></path>
</svg>
<h5>Fashion Pay Coming Soon</h5>
<p>Please select an alternative payment method.</p>
</div>
<div class="mt-accordion-cta-pop-up-background"> </div>
</div>
body {
max-width: 650px;
margin: 30px auto 500px auto;
font-family: "Poppins";
}
/* //////////////////////////////////////////////// */
.mt-accordion {
border: solid 1px #c7c5c5;
background-color: rgb(247, 247, 247);
padding: 10px;
position: relative;
margin: 0 16px;
}
.mt-accordion-item-header {
/* min-height: 3.5rem; */
display: flex;
align-items: center;
position: relative;
cursor: pointer;
}
.mt-accordion-item-header p {
margin: unset;
}
.mt-accordion-item-body {
max-height: 0;
overflow: hidden;
transition: max-height 0.3s ease-out;
position: relative;
}
.mt-accordion-item-body-content {
padding: 10px 0 6px 0;
}
.mt-accordion-item-header__title-container {
width: 95%;
}
.mt-accordion-item-header__title-container > p {
font-size: 12px;
font-weight: 400;
}
.mt-accordion-title-container-logo {
display: flex;
align-items: center;
font-size: 12px;
font-weight: 600;
margin-bottom: 8px;
}
.mt-accordion-title-container-logo__svg {
margin-right: 6px;
}
.mt-accordion-item .chevron {
position: absolute;
right: 10px;
display: flex;
align-items: center;
}
.mt-accordion-item-header.active .chevron {
transform: rotate(180deg);
}
.mt-accordion-item-body-content__credit-message {
margin: 5px 0 0 0;
font-size: 12px;
line-height: 18px;
font-weight: 400;
}
.mt-accordion-item-body-content__inner-container {
background-color: #fff;
padding: 10px 15px;
margin-top: 5px;
margin-bottom: 20px;
}
.mt-accordion-item-body-content-inner-container__title {
font-size: 16px;
line-height: 24px;
font-weight: 600;
margin: 0 0 10px 0;
text-transform: unset;
}
.mt-accordion-item-body-content-inner-container__title > span {
font-size: 10px;
vertical-align: super;
}
.mt-accordion-item-body-content-inner-container__message {
font-size: 12px;
font-weight: 400;
line-height: 18px;
margin: unset;
}
.mt-accordion-item-body-content-inner-container__message > a {
font-weight: 600;
color: #000;
}
.mt-accordion-item-body-content__cta-btn {
background-color: #000d42;
font-size: 14px;
text-transform: uppercase;
line-height: 43px;
font-weight: 600;
color: #fff;
width: 100%;
border: unset;
letter-spacing: 1px;
}
.mt-accordion-item-body-content__cta-btn:hover {
cursor: pointer;
}
.mt-accordion-cta-pop-up {
display: none;
position: absolute;
bottom: -85px;
z-index: 999;
right: 76px;
background-color: #fff;
padding: 15px;
max-width: 280px;
box-shadow: 0px 8px 10px 1px rgba(0, 0, 0, 0.14);
}
.mt-accordion-cta-pop-up h5 {
font-size: 14px;
line-height: 21px;
font-weight: 600;
text-transform: unset;
letter-spacing: unset;
margin: 0 0 12px 0;
}
.mt-accordion-cta-pop-up p {
font-size: 14px;
line-height: 21px;
font-weight: 400;
margin: unset;
}
.mt-accordion-cta-pop-up__chevron {
position: absolute;
top: -15px;
right: 125px;
}
.mt-accordion-cta-pop-up__close {
position: absolute;
right: 6px;
top: 6px;
padding: 10px;
box-sizing: unset;
}
.mt-accordion-cta-pop-up__close:hover {
cursor: pointer;
}
.mt-accordion-cta-pop-up-background {
display: none;
width: 100%;
height: 100%;
/* background-color: rgba(0, 0, 0, 0.25); */
position: fixed;
top: 0;
left: 0;
z-index: 99;
}
.mt-show .mt-accordion-cta-pop-up,
.mt-show .mt-accordion-cta-pop-up-background {
display: block;
}
@media (min-width: 376px) and (max-width: 400px) {
.mt-accordion-cta-pop-up {
right: 59px;
}
}
@media (max-width: 375px) {
.mt-accordion-cta-pop-up {
right: 35px;
}
}
function ready(callbackFunc) {
if (document.readyState !== "loading") {
// Document is already ready, call the callback directly
callbackFunc();
} else if (document.addEventListener) {
// All modern browsers to register DOMContentLoaded
document.addEventListener("DOMContentLoaded", callbackFunc);
} else {
// Old IE browsers
document.attachEvent("onreadystatechange", function () {
if (document.readyState === "complete") {
callbackFunc();
}
});
}
}
ready(function () {
"use strict";
const accordionItemHeader = document.querySelector(
".mt-accordion-item-header"
);
const mtAccordionContainer = document.querySelector(".mt-accordion")
.parentNode;
const mtAccordionElem = document.querySelector(".mt-accordion");
const mtAccordionCTABtn = document.querySelector(
".mt-accordion-item-body-content__cta-btn"
);
const mtAccordionTermsLink = document.querySelector(
".mt-accordion-item-body-content-inner-container-terms"
);
const mtAccordionPrivacyLink = document.querySelector(
".mt-accordion-item-body-content-inner-container-privacy"
);
const mtAccordionPopUpCloseBtn = document.querySelector(
".mt-accordion-cta-pop-up__close"
);
const mtAccordionPopUpBackground = document.querySelector(
".mt-accordion-cta-pop-up-background"
);
// POP UP
mtAccordionCTABtn.addEventListener("click", () => {
mtAccordionElem.classList.add("mt-show");
});
mtAccordionPopUpCloseBtn.addEventListener("click", () => {
mtAccordionElem.classList.remove("mt-show");
});
mtAccordionPopUpBackground.addEventListener("click", () => {
mtAccordionElem.classList.remove("mt-show");
});
// mtAccordionPopUpBackground.addEventListener("click", function () {
// try {
// TrackGAEvent(
// gaData.ga.category,
// gaData.ga.types.click,
// gaClickPopUpBackgroundDataLabel
// );
// } catch (err) {
// console.error(err.message);
// }
// });
// mtAccordionPopUpCloseBtn.addEventListener("click", function () {
// try {
// TrackGAEvent(
// gaData.ga.category,
// gaData.ga.types.click,
// gaClickPopUpCloseBtnDataLabel
// );
// } catch (err) {
// console.error(err.message);
// }
// });
// ACCORDION
accordionItemHeader.addEventListener("click", (event) => {
accordionItemHeader.classList.toggle("active");
const accordionItemBody = accordionItemHeader.nextElementSibling;
if (accordionItemHeader.classList.contains("active")) {
accordionItemBody.style.maxHeight = accordionItemBody.scrollHeight + "px";
// GA - OPENED ACCORDION
// try {
// TrackGAEvent(
// gaData.ga.category,
// gaData.ga.types.click,
// gaClickAccordionOpenedDataLabel
// );
// } catch (err) {
// console.error(err.message);
// }
} else {
accordionItemBody.style.maxHeight = 0;
// GA - CLOSED ACCORDION
// try {
// TrackGAEvent(
// gaData.ga.category,
// gaData.ga.types.click,
// gaClickAccordionClosedDataLabel
// );
// } catch (err) {
// console.error(err.message);
// }
}
});
// mtAccordionCTABtn.addEventListener("click", function () {
// try {
// TrackGAEvent(
// gaData.ga.category,
// gaData.ga.types.click,
// gaClickCheckMyEligBtnDataLabel
// );
// } catch (err) {
// console.error(err.message);
// }
// });
// mtAccordionTermsLink.addEventListener("click", function () {
// try {
// TrackGAEvent(
// gaData.ga.category,
// gaData.ga.types.click,
// gaClickTermsLinkDataLabel
// );
// } catch (err) {
// console.error(err.message);
// }
// });
// mtAccordionPrivacyLink.addEventListener("click", function () {
// try {
// TrackGAEvent(
// gaData.ga.category,
// gaData.ga.types.click,
// gaClickPrivacyLinkDataLabel
// );
// } catch (err) {
// console.error(err.message);
// }
// });
// SHOW ACCORDION
mtAccordionElem.style.display = "block";
});
Also see: Tab Triggers