JSFiddle - React, Tailwind, and code Playground
HTML
<div id="tabContainer">
<ul>
<li class="ignoreMeOne" style="width: 190px;"><span><a href="#">Tab One with more text</a></span></li>
<li class="ignoreMeTwo" style="width: 190px;"><span><a href="#">Tab Two</a></span></li>
<li class="ignoreMeThree" style="width: 190px;"><span><a href="#">Tab Three is wide</a></span></li>
</ul>
</div>
<p>
As You can see I have 3 centered tab headers here. In All browsers except IE7 this works as expected, and perfectly off the bat.
</p>
<p>
In IE7, the tab widths are not obeying the manual <code>style="190px;"</code> on the LI item. However, when <code>left: -50%</code> is removed from the LI's the position is (obviously) off, but the widths are uniform!
</p>
CSS
#tabContainer
{
float: left;
width: 100%;
overflow: hidden;
position: relative;
background-color: #f0f0f0;
}
#tabContainer ul
{
list-style: none;
clear: left;
float: left;
margin: 0;
padding: 0;
position: relative;
left: 50%;
text-align: center;
}
#tabContainer ul li
{
position: relative;
float: left;
display: block;
height: 27px;
margin-left: -25px;
padding-left: 30px;
}
#tabContainer ul li span
{
height: 27px;
padding-top: 9px;
padding-left: 15px;
padding-right: 45px;
display: block;
}
/** Remove This Style to see IE7 Magically Fix itself, (width-wise)
but why does this effect the width? **/
#tabContainer ul li
{
left: -50%;
}
/** JUST USED FOR VISUAL Display purposes, not part of the problem/solution **/
p
{
display: block;
padding: 10px 0px;
font-family: arial;
font-size: 14px;
line-height: 18px;
color: #333;
}
code
{
padding: 1px 5px;
display: inline-block;
background-color: #eee;
font-family: Consolas, Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace, serif;
}
.ignoreMeOne { background-color: #f0ffff; z-index: 2; }
.ignoreMeTwo { background-color: #fff0ff; z-index: 3; }
.ignoreMeThree { background-color: #fffff0; z-index: 1; }