We use cookies on this site to enhance your user experience
By clicking the Accept button, you agree to us doing so. More info on our cookie policy
We use cookies on this site to enhance your user experience
By clicking the Accept button, you agree to us doing so. More info on our cookie policy
Published: Jul 29, 2025 by C.S. Rhymes
I created a free account for Codepen to provide a demo with my blog post about ‘Creating a custom toggle in TailwindCSS’ but it took me a little while to figure out how to use Tailwindcss with codepen. So, this is what I did to get it working.
Looking at the get started guide in Tailwindcss documentation, it states:
Use the Play CDN to try Tailwind right in the browser without any build step. The Play CDN is designed for development purposes only, and is not intended for production.
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"></script>
First I copied and pasted the section from the <head> tags in the Tailwind into the HTML section of Codepen, but you shouldn’t do this.
I got a warning in Codepen saying the HTML section is only for content inside the body tags. So this needed to go somewhere else.
Instead of putting the above in the HTML section, you need to open the Pen settings, by clicking on the Settings button with the big cog.

Once in the settings, click on the HTML section on the left, then find the Stuff for <head> section and paste it in there.
Then click Save and close.
Now you can start writing your HTML in the HTML section and adding the Tailwindcss utility classes. The page will refresh and display your styled content.
As the Tailwindcss documentation states, you can also customise your theme by adding a style tag with the type="text/tailwindcss" attribute.
This seems to work in either the main HTML section or within the Stuff for <head> section in the settings.
<style type="text/tailwindcss">
@theme {
--color-clifford: #da373d;
}
</style>
<p class="text-clifford">Test</p>
Photo by Sergei Gussev on StockSnap
Share
Latest Posts
Recently I had the opportunity to work on a new side project. I had already decided I wanted to use Laravel and Livewire, but I wasn’t sure about the frontend user interface. I had seen some demos of Flux UI and liked what I had seen, so decided to give it a try.
I thought I’d share some learnings about how to host a Next.js site with AWS Elastic Beanstalk. This is a minimum configuration to get a basic site up and running.
I’ve seen a few posts recently asking what other authors use for their website. There are many options available, but sometimes you just want a single page with links to your social media profiles and links to your books. This is where Bulma Clean Theme and GitHub pages can come to the rescue.
Unlooked for Tales - a collection of short stories
By C.S. Rhymes
Free on Apple Books and Google Play Books
Nigel's Intranet Adventure
By C.S. Rhymes
From £0.99 or read for free on Kindle Unlimited!