K
K
koteus2011-02-20 16:49:07
css
koteus, 2011-02-20 16:49:07

How to center td in table

There is a table in the site header:

<code class="html">
    <table>
        <tr>
            <td></td>
            <td>Tra la la</td>
            <td></td>
        </tr>
    </table>
</code>

The table is stretched to full page.
The left cell is filled with one color, and the right one with another (+ they are rubber).
The middle one has a picture where the visual combination of colors takes place and the inscription is located (width 960px).

It is very necessary that the middle cell be in the center (regardless of the type of browser).

Answer the question

In order to leave comments, you need to log in

4 answer(s)
A
Artqookie, 2011-02-20
@Artqookie

Tested only in Ubuntu, browsers: Chromium 11.0.672.2 (75134), Firefox 3.16.13, Opera 11.01
<table>
<tr>
<td style="width: 50%; background: yellow;"></td>
<td style="background: green;"><div style="width: 960px;"> </div></td>
<td style="width: 50%; background: blue;"></td>
</tr>
</table>

P
Prometheus, 2011-02-20
@Prometheus

For this case it is enough to draw two floating divs, 50% each with the given bgcolor.
And place the image in the third div (position:absolute;top:0;width:100%;text-align:center;), which is superimposed on top of those two color ones.

P
Prometheus, 2011-02-20
@Prometheus

I would not make a "hole" in the background of the blue plate.
I would make a substrate in the block with the logo - a gray circle.

K
koteus, 2011-02-20
@koteus

9.0
But it seems to be my fault. I have some divs left in the left and right cells. I removed them and everything seems to be ok, thanks. Probably from lack of sleep :)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question