Very very simple table question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Daniel

    Very very simple table question

    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.gi f">
    TEXT_A
    </td>
    <td>
    TEXT_B
    </td>
    </tr>
    </table>

    +--------------------+----------------+
    |+-----+ | |
    || Pic | |TEXT_B |
    |+-----+ TEXT_A | |
    +--------------------+----------------+
  • Vigil

    #2
    Re: Very very simple table question

    On Thu, 22 Jan 2004 12:42:59 -0800, Daniel wrote:
    [color=blue]
    > How can get everything to
    > align in the vertical middle?[/color]

    <td valign=center>

    --

    ..

    Comment

    • Steve Pugh

      #3
      Re: Very very simple table question

      Vigil <me@privacy.net > wrote:[color=blue]
      >On Thu, 22 Jan 2004 12:42:59 -0800, Daniel wrote:
      >[color=green]
      >> How can get everything to
      >> align in the vertical middle?[/color]
      >
      ><td valign=center>[/color]

      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 <steve@pugh.net > <http://steve.pugh.net/>

      Comment

      • Topher

        #4
        Re: Very very simple table question

        si_mon_key@hotm ail.com (Daniel) wrote in message news:<a36b8d1a. 0401221242.61f1 59d0@posting.go ogle.com>...[color=blue]
        > 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.gi f">
        > TEXT_A
        > </td>
        > <td>
        > TEXT_B
        > </td>
        > </tr>
        > </table>
        >
        > +--------------------+----------------+
        > |+-----+ | |
        > || Pic | |TEXT_B |
        > |+-----+ TEXT_A | |
        > +--------------------+----------------+[/color]

        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.gi f' 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 |
        |+-----+ | |
        +--------------------+----------------+

        Comment

        • Daniel

          #5
          Re: Very very simple table question

          Thank you all for your help. The code Chris provided worked perfectly.

          -daniel

          chris@mkttl.co. uk (Topher) wrote in message news:<f4487ccf. 0401230532.1f37 23b@posting.goo gle.com>...[color=blue]
          > si_mon_key@hotm ail.com (Daniel) wrote in message news:<a36b8d1a. 0401221242.61f1 59d0@posting.go ogle.com>...[color=green]
          > > 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.gi f">
          > > TEXT_A
          > > </td>
          > > <td>
          > > TEXT_B
          > > </td>
          > > </tr>
          > > </table>
          > >
          > > +--------------------+----------------+
          > > |+-----+ | |
          > > || Pic | |TEXT_B |
          > > |+-----+ TEXT_A | |
          > > +--------------------+----------------+[/color]
          >
          > 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.gi f' 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 |
          > |+-----+ | |
          > +--------------------+----------------+[/color]

          Comment

          Working...