Ozkan
Ozkan

Reputation: 67

Table second td is under first td (image)

I have a layout issue with tables here. I know this is not the best practice but it must be done like this.

So I have the following table:

<table>
  <tbody>
    <tr>
      <td>
        <img src="/arte.jpg" alt=""/>
      </td>
      <td>
        <strong>Mira en Scheldeland</strong>
       </td>
    </tr>
  </tbody>
</table>

The problem is that second td is not at same height as the image. Like this:

TD1
   TD2

I tried valign but this doesn't work.

Can I get any help?

Upvotes: 1

Views: 291

Answers (4)

jefsmi
jefsmi

Reputation: 731

Valign should solve your problem here... Check this example: http://jsfiddle.net/Ahrhq/

I tested it in IE7, IE8, IE9, Chrome, Firefox ... otherwise give us some more info about your stylesheet(s)

Upvotes: 2

checkenginelight
checkenginelight

Reputation: 1146

If you want your text to be aligned top with the image just make sure there is no padding or that padding top/bottom is the same for both td tags.

Otherwise to have it both align middle just take off the valign values.

Lastly you could try to take off < tbody >

Upvotes: 0

Pedro Costa
Pedro Costa

Reputation: 2996

I've seen this kind of behaviour when floating is applied to the td

can you check with firebug, or similar, whether it's being applied float in the stylesheets?

There's definitely something up with the page's CSS.

Also check if you're missing the doctype.

Upvotes: 0

user610217
user610217

Reputation:

your image tag is not properly terminated:

<img src="/arte.jpg" />

Upvotes: 0

Related Questions