开发者

Table second td is under first td (image)

开发者 https://www.devze.com 2023-04-03 10:48 出处:网络
I have a layout issue with tables here. I know this is not the best practice but it must be done like this.

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>
</t开发者_如何学Goable>

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?


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)


your image tag is not properly terminated:

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


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.


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 >

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号