Our new code playground
Back in 2014, we launched our first code playground at codeit.co. It let you write HTML, CSS and JavaScript in your browser, see the result straight away, and save your work to share with others. It served us well for years, but it was showing its age, so we closed it.
Now it's back, rebuilt from scratch. The new CSS Portal Playground works on computers, phones and tablets, and is free to use with no sign-up.
Thank you to everyone who used the original, shared their experiments and sent us feedback. The rest of this post explains what it does and how to get started.
Good to know: anything saved on our old playground was removed when it closed, and the old codeit.co links no longer work. If you had demos there, you'll need to recreate them in the new playground. The steps below make that quick.
What is a code playground?
A code playground is a website where you can write and run front-end code without installing anything. You type HTML, CSS and JavaScript into separate panels, and a live preview updates as you type.
Playgrounds are perfect for:
- Learning: try the examples from our blog posts and change the numbers to see what happens.
- Experimenting: test an idea quickly, without setting up a whole project.
- Getting help: share a small example of a problem so others can see exactly what's going wrong.
- Showing off: share your creations with a single link.
What our playground can do
We've kept it simple and focused on what you need to learn and experiment. There are no accounts to create and no public gallery: your work is only seen by people you share the link with.
| Feature | What it does |
|---|---|
| Live HTML, CSS and JavaScript editing | The preview updates as you type, or switch off Auto and run your code when you're ready. |
| Save and share | Get a short link for your work, with no sign-up needed. |
| My playgrounds | See everything you've saved in one list, and move it to another device. |
| Fork | Make your own copy of any playground to experiment with. |
| External CSS and JavaScript | Add libraries, frameworks and web fonts from any CDN. |
| Built-in console | See console.log() output and errors, with the line number in your code. |
| Loop protection | Stops an accidental never-ending loop before it freezes your browser. |
| Two layouts | Editors on top or on the side, with a divider you can drag. |
| Light and dark themes | Matches your device, or choose your own. |
| Download as HTML | Save your work as a single file you can open anywhere. |
Tip: you can start typing the moment the page loads. Your work is kept as a draft in your browser until you save it, so closing the tab by accident won't lose it.
Getting started
- Go to playground.cssportal.com.
- You'll see three panels labelled HTML, CSS and JS, with a preview area alongside.
- Type or paste your code into the panels. The preview updates automatically.
- Click Save to keep your work. It gets its own web address you can come back to or share.
Try it now
Paste this into the HTML panel:
<button class="btn">Hover over me</button>
And this into the CSS panel:
body {
display: grid;
place-items: center;
min-height: 100vh;
margin: 0;
font-family: system-ui, sans-serif;
}
.btn {
padding: 0.7em 1.6em;
font-size: 1.1rem;
font-weight: 600;
color: #ffffff;
background: #1d4ed8;
border: 0;
border-radius: 999px;
cursor: pointer;
transition: translate 0.2s ease, box-shadow 0.2s ease;
}
.btn:hover {
translate: 0 -3px;
box-shadow: 0 8px 20px rgb(29 78 216 / 0.35);
}
You'll see a blue button in the middle of the preview that lifts up when you hover over it. Now try changing the colour, the border-radius or the shadow, and watch the result update as you type. That's the best way to learn CSS: change one thing at a time and see what happens.
You don't need to add <html>, <head> or <body> tags, or link your CSS and JavaScript. The playground puts everything together for you.
Adding libraries and fonts
Adding a library
Our old playground let you add libraries to the <head> of your page, and the new one does too:
- Open the ⋯ menu at the top right and choose External CSS / JS….
- Paste the web address of a CSS file into Stylesheets, or a JavaScript file into Scripts, one per line.
- Click Apply. The addresses are saved with your playground.
The library loads before your own code, just as if you'd added a <link> or <script> tag yourself, so your CSS can override it and your JavaScript can use it straight away.
Adding a web font
Web fonts work the same way. Paste the font's stylesheet address into Stylesheets, for example:
https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap
Then use it in your CSS with font-family: 'Inter', sans-serif;.
Tip: the playground uses plain CSS rather than a preprocessor such as Sass. Modern CSS now includes many features that used to need one, such as custom properties (variables) and nesting, and they work right in the playground. If you're just starting out, plain CSS is a great place to begin.
Saving, sharing and forking
Sharing a link
Every saved playground has its own web address. Click Share to copy it, then send it to a friend, post it in a forum or include it in a question when you're asking for help. Anyone with the link can see and run your code, but only you can change it.
Forking
Opened someone else's playground and want to experiment? Change whatever you like, then click Save copy to keep your own version. The original stays exactly as it was. On your own work, Fork does the same, so you can try a new idea without changing a link you've already shared.
Finding your work again
Open the ⋯ menu and choose My playgrounds… to see everything you've saved. Because there are no accounts, this list is kept in your browser. To use it on another computer, click Export, then Import the file on the other device.
Key rule: anyone with the link to a playground can see its code. Never paste passwords, private keys or personal information into a playground.
Handy extras
A few more features that make experimenting easier:
- The console: click Console under the preview to see messages and errors. You can also type JavaScript there to try it on your page.
- Loop protection: if a loop runs for more than a second, the playground stops it and tells you which line it was on.
- Switch layout: from the ⋯ menu, put the editors on top or on the side, and drag the divider to resize. While you drag, the preview shows its size in pixels, which is handy for testing media queries.
- On your phone: on small screens the panels become tabs, so you can experiment anywhere.
- Download as HTML: get your work as a single file to open in any browser or use as the start of a real project.
Keyboard shortcuts save a lot of clicking:
| Shortcut | What it does |
|---|---|
| Ctrl + Enter | Run your code |
| Ctrl + S | Save |
| Ctrl + / | Comment or uncomment lines |
| Tab / Shift + Tab | Indent or outdent |
On a Mac, use ⌘ instead of Ctrl. For everything else, see the playground help guide.
Many of our tutorials include live Results boxes, so you can see each example working right on the page. When you want to experiment further, copy the code into the playground and make it your own.
Wrapping up
Our first playground served us well, and we're excited to have a new one back on CSS Portal. Head over to the playground, paste in an example from one of our posts, and start experimenting. We'd love to see what you create, so send us a link!