10 Simple Code Snippets for Creating Beautiful Tabs
Tabs are a fundamental part of the web, and they’ve been around for years, but with even more developers going open source there’s a whole world of free code snippets out there.
If you’re building a tabbed widget you could always start from scratch, or you could rework someone else’s code and style the element to fit your project.
That’s why I collected this collection of the best tabbed widget snippets. Each is unique, easy to work with, and offers bountiful code you can copy & edit into your own work.
1. Glowing Tabs
Looking at these very unique glowing tabs you might be surprised to learn they run primarily in CSS. There is a jQuery function to create the sliding effect but the entire design is built on CSS code.
Developer Simon Goellner created this as an interesting project for tabbed widgets. The container stays at a fixed height which is really important for some pages.
Also the downward-pointing carets let you know which element is currently active along with the element you’re hovering. It’s a pretty sleek tabbed widget and would certainly fit inside any typical website.
But I think it would fit especially well in a minimalist layout where the tab styles could really shine.
2. Tabbed Widget
Want something a little smaller and easier to handle? Take a look at this simple tabbed widget created by CSSFlow.
It’s a pretty simple idea, but the functionality is most surprising. The entire tabbed widget runs on CSS so it should work in most modern browsers without a hitch. The highlighting effect on the selected tab is a welcome attribute for grabbing attention and keeping focus on the page.
Plus you could easily expand this widget to be a lot wider and thicker, housing more content while keeping all tabs the same size.
3. Aria Tabs
These custom Aria Tabs were built for simplicity and the widest range of usability. It does run on jQuery but it’s also meant to support ARIA attributes for screen readers and other accessibility concerns.
That’s why the tabs are so simple. Each one does include a custom CSS animation, but the actual behaviors are fully compliant with basically all browsers.
You may need to spend a bit of time in this code if you want to get these working in your own project. But it’s also a simple process once you understand the jQuery.
How often do you see these kinds of tabbed schedule widgets on conference sites? They’re practically a cornerstone of every conference to help sell the event and the speakers.
With this scheduling widget you can quickly recreate a similar element for any page style. This lets you define custom widgets and switch between them using a bit of jQuery.
5. Variable Heights
Looking for variable height tabs that adjust based on content? This may seem like a difficult task without causing massive page jumps.
But developer Joseph Fusco accomplished a beautiful transitioning tabbed widget that relies solely on CSS. Pretty impressive considering the transitions are crazy smooth!
The content has its own fading effect, and the container is variable width too. So you can run two tabs or 10 and still fit all the content you need.
6. Pure CSS Tabs
I’ll admit the colors are a bit simple and there’s plenty of room to customize this thing with a totally new look. But from a user experience perspective, these tabs are fantastic, and they feel genuine for a CSS-only solution.
7. Simple Tab Designs
Actually the animation is pretty darn cool since it’s not something you typically see. The individual tab contents slide down & out of view almost like notecards.
This whole widget feels incredibly light, and it’s definitely one of the coolest tabbed features with universal appeal.
8. Rounded Tabs
Back when rounded corners required CSS hacks it would’ve taken hours to create tab styles like this. But now with CSS3 you can easily build a rounded tab widget with just a few dozen lines of CSS.
A nice little widget if you’re looking for simple tabs that span the entirety of the container(or the page!)
9. Animating Tabbed Content
You can always add some custom animation work to your page for a bit of life. The key is knowing what to animate and how much is too much.
In this pure CSS tabbed widget you’ll notice the only animation is the content. Once you click on a tab, it’ll automatically animate the content into view from the side. This happens with each click, so it’s an effect your visitors can get accustomed to.
One thing I don’t like about this demo is the length of time for the animation. Visitors want results fast so I’d work to increase the loading speed on this before launching live on the web.
10. Adaptive Tabs
There’s a lot to say about these adaptive tabs by Lewi Hussey.
The hover effects are fantastic and feel unique to this widget. But the animation effects and the transitions are what really take the cake.
It feels incredibly smooth, and there’s no risk of a huge page jump when moving from a content-heavy tab to a smaller one. This has to be one of the simplest tab widgets offering the most value, and it could make a great template for web dev projects.
The post 10 Simple Code Snippets for Creating Beautiful Tabs appeared first on Speckyboy Web Design Magazine.
Source: Specky Boy