Hello. I'm Aleksandar Vacić, professional web developer and wine maker in the making.
Learn more about me or see what I can do for you.

My work & services

Overlapping Windows

I’m in danger of becoming tab-fanatic. It’s not my fault, really. All the stuff presented here, either as Sparks or hidden away as casual posts are the fruit or consequence of my day job. The curse of working the job you love is that you don’t leave it in the office. I encounter the problem and instead of working on it for few days, I take it home and finish it up in the wee hours.

And for some reason, I often encounter tabs. Tabs are self-contained and can easily be extracted from the layout where they are used. As such, they make perfect post-topic.

It’s hard to do something new in tabs domain. I thought that too when few months ago (yes, that’s how much it took me to write this) I looked for tabs that overlap each other. You see, all the various tab techniques around the Net, no matter how graphically different they are, share one common attribute. The linked parts of the tabs do not overlap, like the following well-known examples illustrate.

the usual lists

The area you hover will change only part of the screen occupied by li and/or a. It does not change anything outside that block. And I need to implement just such design.

overlapping tabs

Markup

The markup basis is usual li/a combination. However, with just those two elements, I couldn’t find a way to implement this design, and still keep it flexible. It is possible with generated content and :after selector, but I needed this to work in all current browsers, as it was going to be used on live web site for the client.

The problematic part is how to cover the hanging part, which goes over the neighboring tab. To do that, additional element is needed.

<ul>
<li><a href="#"> Tab item <span></span></a></li>
</ul>

You’ll see its use shortly.

CSS styling

I don’t want to go into details here, as tabs styling using Sliding Doors technique is a must for every web designer. The new stuff here is the additional span. Its parent element, a, will be relatively positioned, and span will be positioned absolutely, just outside of lower right corner of the link’s block.

the hanging part of the active tab
#tabs a:hover, #tabs li.current a {
	position: relative;
	z-index: 1;
}

#tabs a:hover {
	z-index: 10;
}

#tabs a span {
	display: none;
}

#tabs li.current a span, #tabs a:hover span {
	background: url(images/overlap.png) no-repeat center;
	width: 23px;
	height: 23px;
	position: absolute;
	right: -23px;
	bottom: 0;
	display: block;
}

This was tested and it works in IE Win, IE Mac, Firefox, Safari 1.2, Opera 7.5, Omniweb 5.0. The working example can be seen here, and it is linked in the Sparks area, here on my site.

Possible problems

You need to be careful not to cover the text when you overlap tabs. Also, the active area of the current tab is extended to the overlapping part, so if that area is large, the next item will be harder to select.

Name

When I thought how to name these tabs, my eyes fell on Sliding Doors name. That’s a good, memorable name. And since the name is an important part, I decided to call this Overlapping Windows. :)

tags: CSS
Comments: 6

Posted 5 years, 5 months agopermanent link

trackback URL: http://aplus.rs/css/overlapping-windows/trackback/

Voices from the crowd, 6 so far

This is very cool!

The main problem I notice (in Safari) is when going from right to left, you’ll still have the right tab selected as you move onto the bottom curve of the one to the left.

by Jeff Wheeler
2 days, 11 hours after the post

Yes, I agree. There’s not really a solution to that, until W3C gives us link elements with iregular shape. :)

Seriously, I think that people are unconsiously drawn to the text of the link, and would point the mouse there, not to the edge or the curve. At least I am. That would hopefully prevent much frustration. I’m about to go live with this technique on the client site (a week or two at most) so we’ll see what the feedback would be.

by Aleksandar
2 days, 21 hours after the post

That’s true. It does look great as it is, despite the minor problem I noted.

by Jeff Wheeler
1 week, 2 days after the post

These are great horizontal tabs!!

It is possible to make VERTICAL tabs, similar to the horizonal tabs you have here? There is a great example at:
http://www.msnbc.msn.com/id/7504443/

I cant see how they did this. Its not an control or anything. Looks to be Javascript but I am just starting out in all this so its baffling to me. However, as verticals go — the MSNBC page tabs look great.

by Mike
1 month after the post

Please help. I’m having focus problems on a page using both suckerfish dropdowns over your “overlapping windows” style secondary nav.

Works great in Mozilla, but in ie, my suckerfish ul’s don’t layer over the overlapping nav correctly.

My demo:

http://www.barkhamcreative.com/trouble/template/content.htm

My css:

http://www.barkhamcreative.com/trouble/styles/style.css

by Graham
3 months, 2 weeks after the post

Hey guys check out my overlapping tabs example with hover/z-index. So far I haven’t come across anything as simple as mine. It doesnt use any CSS hacks or Javascript. Tested and works perfect in FireFox and IE.

http://anythingclose.com/css-overlapping-tabs.php

by martin
1 year, 8 months after the post

Post your opinion


? You need to enter your email, but rest assured it will not be published.

? Enter the link and it will be published.
? This blog strives to behave properly, as per XHTML 1.0 Strict spec. You can use the following tags, but please use them wisely:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>
? I have enabled comment moderation so if your comment does not shows up after you submit it, don't worry. I will review it and if it's nice and to the point, I'll approve it. This measure is up mostly to fight spam and trolls.

Tags or categories or topics...

Lots of ramblings on this blog...might be easier for you to find your juice through these tags:

Post a job. Find one. authenticjobs.com