Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

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.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

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.

+ add another resource

Packages

Add Packages

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.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <body class="bg-slate-200 flex items-center justify-center min-h-screen">
    <div class="w-full sm:max-w-[38rem] p-5 sm:p-0 [&_*]:transition-all [&_*]:ease-linear [&_*]:duration-150">
        <div>
            <div class="flex items-center justify-between flex-wrap gap-y-3 mb-10">
                <h2 class="text-2xl sm:text-3xl font-bold text-slate-900">Choose your plan</h2>
                <div class="flex text-xs rounded-full bg-slate-300 w-fit [&>*]:px-2 [&>*]:py-1 [&>*:hover]:bg-white [&>*:hover]:shadow-sm [&>*:hover]:shadow-slate-800 p-0.5 [&>*]:cursor-pointer [&>*]:rounded-full gap-3">
                    <p id="month">Monthly</p>
                    <p id="year" class="bg-white">Yearly</p>
                </div>
            </div>

            <div class="flex items-center justify-between flex-wrap gap-y-5 [&>*:hover]:shadow-md [&>*:hover]:shadow-slate-900 [&>*>h2]:text-lg [&>*>h2]:font-bold [&>*>h2]:text-slate-900 [&>*]:flex [&>*]:justify-between [&>*]:flex-col [&>*>div>p]:text-sm [&>*>div>p]:text-slate-600 [&>*>p]:text-xs [&>*>p]:text-slate-400 [&>*]:w-full [&>*]:sm:max-w-[18rem] [&>*]:h-[18rem] [&>*]:p-8 [&>*>div>div>h2]:text-lg [&>*]:bg-white [&>*]:rounded [&>*>div>div>h2]:font-bold [&>*>div>div>h2]:text-slate-900">
                <div>
                    <h2>Starter</h2>

                    <div>
                        <div id="starter"><h2>$8.99/month</h2></div>
                        <p id="starter_in">Billed yearly</p>
                    </div>

                    <p>
                        Pretium fusce id velit ut tortor pretium. Sit amet consectetur adipiscing elit ut. 
                        Condimentum mattis pellentesque id nibh. Euismod elementum. 
                    </p>

                    <div class="border border-slate-900 cursor-pointer active:scale-95 bg-slate-900 text-white hover:bg-white hover:text-slate-900 text-sm py-2 rounded text-center font-bold">
                        <h3>Get Started</h3>
                    </div>
                </div>

                <div>
                    <h2>Professional</h2>

                    <div>
                        <div id="pro"><h2>$21.99/month</h2></div>
                        <p id="pro_in">Billed yearly</p>
                    </div>

                    <p>
                        Duis at consectuetur lorem donec massa sapien faucibus. Ac placerat vestibulum lectus mauris.
                    </p>

                    <div class="border border-slate-900 cursor-pointer active:scale-95 hover:bg-slate-900 hover:text-white bg-white text-slate-900 text-sm py-2 rounded text-center font-bold">
                        <h3>Get Started</h3>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <script src="main.js"></script>
</body>
              
            
!

CSS

              
                
              
            
!

JS

              
                const month = document.getElementById("month");
const year = document.getElementById("year");
const starter = document.getElementById("starter");
const pro = document.getElementById("pro");
const starter_in = document.getElementById("starter_in");
const pro_in = document.getElementById("pro_in");

month.addEventListener("click", ()=>{
    month.classList.add("bg-white");
    year.classList.remove("bg-white");
    starter.innerHTML = `<h2>$2.99/week</h2>`
    starter_in.innerHTML = "Billed monthly"
    pro.innerHTML = `<h2>$5.99/week</h2>`
    pro_in.innerHTML = "Billed monthly"
})

year.addEventListener("click", ()=>{
    year.classList.add("bg-white");
    month.classList.remove("bg-white");
    starter.innerHTML = `<h2>$8.99/month</h2>`
    starter_in.innerHTML = "Billed yearly"
    pro.innerHTML = `<h2>$21.99/month</h2>`
    pro_in.innerHTML = "Billed yearly"
})
              
            
!
999px

Console