By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,246 Members | 1,304 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,246 IT Pros & Developers. It's quick & easy.

Very very simple table question

P: n/a
I'm having a tough time getting text and image to align in a table.
When I add the image for some reason the text in that cell shifts to
the bottom of the cell. Below is the code and the result. How can
get everything to align in the vertical middle? Thank you.

<table>
<tr>
<td>
<img src="picture.gif">
TEXT_A
</td>
<td>
TEXT_B
</td>
</tr>
</table>

+--------------------+----------------+
|+-----+ | |
|| Pic | |TEXT_B |
|+-----+ TEXT_A | |
+--------------------+----------------+
Jul 20 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
On Thu, 22 Jan 2004 12:42:59 -0800, Daniel wrote:
How can get everything to
align in the vertical middle?


<td valign=center>

--

..

Jul 20 '05 #2

P: n/a
Vigil <me@privacy.net> wrote:
On Thu, 22 Jan 2004 12:42:59 -0800, Daniel wrote:
How can get everything to
align in the vertical middle?


<td valign=center>


Wrong.
valign="middle" to vertically center content within a cell.
align="center" to horizontally center content within a cell.

However, this won't work for the OP unless he moves the image into a
separate cell (BTW valign="middle" is the default, as the OP's sample
didn't have any other value set it would have been working already if
this was the solution).

The solution is to set align="left" or float: left; on the image. (Or
align="middle" if it can 100% definite that the text will not wrap
onto another line).

Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <st***@pugh.net> <http://steve.pugh.net/>
Jul 20 '05 #3

P: n/a
si********@hotmail.com (Daniel) wrote in message news:<a3**************************@posting.google. com>...
I'm having a tough time getting text and image to align in a table.
When I add the image for some reason the text in that cell shifts to
the bottom of the cell. Below is the code and the result. How can
get everything to align in the vertical middle? Thank you.

<table>
<tr>
<td>
<img src="picture.gif">
TEXT_A
</td>
<td>
TEXT_B
</td>
</tr>
</table>

+--------------------+----------------+
|+-----+ | |
|| Pic | |TEXT_B |
|+-----+ TEXT_A | |
+--------------------+----------------+


If you try aligning the image, you should get the text to wrap round
it and not go straight to the bottom... Something like

<table>
<tr>
<td valign='middle'><img src='picture.gif' align='left'> TEXT_A</td>
<td valign='middle'>TEXT_B</td>
</tr>
</table>

That should (I think, although I am doing from memory) work out like
below...

+--------------------+----------------+
|+-----+ | |
|| Pic | TEXT_A |TEXT_B |
|+-----+ | |
+--------------------+----------------+
Jul 20 '05 #4

P: n/a
Thank you all for your help. The code Chris provided worked perfectly.

-daniel

ch***@mkttl.co.uk (Topher) wrote in message news:<f4*************************@posting.google.c om>...
si********@hotmail.com (Daniel) wrote in message news:<a3**************************@posting.google. com>...
I'm having a tough time getting text and image to align in a table.
When I add the image for some reason the text in that cell shifts to
the bottom of the cell. Below is the code and the result. How can
get everything to align in the vertical middle? Thank you.

<table>
<tr>
<td>
<img src="picture.gif">
TEXT_A
</td>
<td>
TEXT_B
</td>
</tr>
</table>

+--------------------+----------------+
|+-----+ | |
|| Pic | |TEXT_B |
|+-----+ TEXT_A | |
+--------------------+----------------+


If you try aligning the image, you should get the text to wrap round
it and not go straight to the bottom... Something like

<table>
<tr>
<td valign='middle'><img src='picture.gif' align='left'> TEXT_A</td>
<td valign='middle'>TEXT_B</td>
</tr>
</table>

That should (I think, although I am doing from memory) work out like
below...

+--------------------+----------------+
|+-----+ | |
|| Pic | TEXT_A |TEXT_B |
|+-----+ | |
+--------------------+----------------+

Jul 20 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.