MaureenT
11-01-2008, 05:22 AM
I am attempting to convert a Web site to CSS from a tables layout, and I've run into a problem that's driving me nuts. Below is a screen capture of a simple table.
http://www.mthayer.com/table.jpg
The code for the table is:
<table border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="right" style="padding-right:7px"><img src="images/florish_left.gif" alt="" width="45" height="25"></td>
<td align="center" nowrap><span class="verdana20px-red">Page Title </span></td>
<td align="left" style="padding-left:7px"><img src="images/florish_right.gif" alt="" width="45" height="25"></td>
</tr>
</table>
As you can see, the table is centered on the page, and both the table and center cell do not have a fixed width. This is so that the center cell will resize automatically to fit the contents.
And that's the reason for the problem I'm having with duplicating this in CSS. If that center area had a fixed width, there would be no problem.
So, in summary, this is what the CSS needs to do:
Horizontally center the group of objects on the page.
Center the page title between the two images.
Enable the center "container" to resize automatically to fit the contents.
Works in both IE and other browsers.
If anyone can figure this out, I'd really appreciate it. With tables, this is so simple, but, with CSS, I just can't find the way to do it.
If there was a way of vertically aligning images in relation to text so that I'd get the same result, I wouldn't even bother with CSS for this, but there isn't.
http://www.mthayer.com/table.jpg
The code for the table is:
<table border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="right" style="padding-right:7px"><img src="images/florish_left.gif" alt="" width="45" height="25"></td>
<td align="center" nowrap><span class="verdana20px-red">Page Title </span></td>
<td align="left" style="padding-left:7px"><img src="images/florish_right.gif" alt="" width="45" height="25"></td>
</tr>
</table>
As you can see, the table is centered on the page, and both the table and center cell do not have a fixed width. This is so that the center cell will resize automatically to fit the contents.
And that's the reason for the problem I'm having with duplicating this in CSS. If that center area had a fixed width, there would be no problem.
So, in summary, this is what the CSS needs to do:
Horizontally center the group of objects on the page.
Center the page title between the two images.
Enable the center "container" to resize automatically to fit the contents.
Works in both IE and other browsers.
If anyone can figure this out, I'd really appreciate it. With tables, this is so simple, but, with CSS, I just can't find the way to do it.
If there was a way of vertically aligning images in relation to text so that I'd get the same result, I wouldn't even bother with CSS for this, but there isn't.