I am having a problem centering text in a table header that uses divs to place a rounded corner image on the left side of the header and a gradient fade image on the right side of the header. As the header expands or shrinks based on the user's browser width, this leaves a varying width between the images in which to place the header text. I can center the header text within this varying amount of space, however, I want to center the text across the entire header width, including the width of both images.
For example, the left corner image is 14 px wide and the right gradient image is 140px wide. If the header width is 800px total, the header text is centered in the available 646px. What I would like to do is center it in the entire 800px.
Any ideas?
CSS:
table.contentmodule {
width:100%;
}
th.contentmodule {
width:100%;
padding: 0px;
font-family: Arial, Verdana, Tahoma, Helvetica, sans-serif;
font-weight: bold;
font-size: 11px;
background-color: #cccccc;
}
.cmhleft {
float: left;
background-image: url(common/images/gray_cor
ner_14.gif
);
background-repeat: no-repeat;
width: 14px;
height: 14px;
}
.cmhright {
float:right;
background-image: url(common/images/gray_gra
dient_140.
gif);
background-repeat: no-repeat;
width: 140px;
height: 14px;
}
.cmhtext {
width: 100%;
text-align: center;
}
td.contentmodule {
width:100%;
padding: 5px 5px;
font-family: Arial, Verdana, Tahoma, Helvetica, sans-serif;
font-weight: normal;
font-size: 11px;
}
HTML:
<table class="contentmodule">
<tr>
<th class="contentmodule">
<div class="cmhleft"></div><div
class="cmhright"></div>Som
e Other Committee
</th>
</tr>
<tr>
<td class="contentmodule">
Some other committee information.....<br>
Some more other committee information.....<br>
Still more other more information.....<br>
<a href="#" class="contentmodule">A link.....</a><br>
<a href="#" class="contentmodule">Anot
her link.....</a><br>
<a href="#" class="contentmodule">Yet another link.....</a>
</td>
</tr>
</table>
Thanks.
Alan Pollenz
Start Free Trial