tags:

views:

137

answers:

4

I've got a series of tabs on a page. The tabs are set to relative position. They are then moved 15px to the left. The resulting style looks like this:

style="position:relative;left:-15px" (note that each tab's left is going to be -15 * tab number - so #2 will be -15, #3 is -30, etc.)

This gives the tabs a nice overlapping feel, which is wanted. However, the downside is that the original "width" (without the move to the left) of the tabs is used when centering the table. The result is that the table feels lop-sidded.

Is there anyway to tweak this behavior?

A: 

maybe you could add a padding element to the left side. width: #tabs * 15

Ulf
A: 

You could position the tab container: left: (7.5 * tab number)

willoller
+1  A: 

Instead of nudging the <li>s with 'position: relative', you could apply this to each tab (except for the first tab):

margin-left: -15px;

EDIT: Example of the concept...

<div style="text-align:center;">
<img src="http://www.google.com/intl/en_ALL/images/logo.gif" />
<img style="margin-left: -54px;" src="http://www.google.com/intl/en_ALL/images/logo.gif" />
<img style="margin-left: -54px;" src="http://www.google.com/intl/en_ALL/images/logo.gif" />
<img style="margin-left: -54px;" src="http://www.google.com/intl/en_ALL/images/logo.gif" />
</div>
David Kolar
That would only overlap the second tab on the first. They third tab would have to have a margin of -30px to overlap the second, because the second is already has the -15px margin. The fourth would have to have a -45px margin, and so on...
Ty
@Ty: Sorry, but that's just untrue. The margin is only applied to one side and does not need to change between items. Tested in IE6, IE7, FF2, FF3, Opera 9, Safari, and Chrome.
David Kolar
Shit. My bad. I don't know where my head was. I've given you my vote and removed my answer. This is definitely the way to go about it. Sorry about that. :)
Ty
No problem; thanks for giving it a second look. :)
David Kolar
A: 

Set the left margin of the container to -((tabWidth) * (numTabs)) possibly?

Plan B