2016-01-19 29 views
1

我的表的结构是为什么我的正确单元格总是达到196像素的高度?

   <table border="0" cellpadding="0" cellspacing="0"> 
        <tr> 
         <td width="404"> 
          <img src="assets/Hero-Image2.png" width="404" height="192" style="width:404px;height:192px;border:0;margin:0;outline:0;"/> 
         </td> 
         <td width="396" bgcolor="#00188F"> 
          <h1 style="color:#FFF;font-family:Segoe,Tahoma,Verdana,Arial,sans-serif;font-size:16pt;font-weight:100; margin-bottom:10px;">Simpilfied IT management for any enterprise</h1> 
          <h2 style="color:#FFF;font-family:Segoe,Tahoma,Verdana,Arial,sans-serif;font-size:14pt;font-weight:100;">Gain control over any hybrid cloud with our cost-effective all-in-one cloud solution</h2> 
         </td> 
        </tr> 
       </table>  

A和我想的第一个单元格内的图像具有相同的高度,第二个单元格(使图像混合到它的背景颜色。我知道有这样做的替代方法,但我受到限制,因为这是一个用于Outlook的HTML电子邮件)。

眼下正确的细胞是总是具有196px的高度,即使我剥其内容没什么:

   <table border="0" cellpadding="0" cellspacing="0"> 
        <tr> 
         <td width="404"> 
          <img src="assets/Hero-Image2.png" width="404" height="192" style="width:404px;height:192px;border:0;margin:0;outline:0;"/> 
         </td> 
         <td width="396" bgcolor="#00188F"> 

         </td> 
        </tr> 
       </table> 

右边的单元格始终是196px,这将导致左边的单元格是相同的高度。没有意义。

enter image description here

回答

0

什么是你的图像的尺寸? 我不认为HTML是“聪明的”,足以伸展你的形象,以适应你的确切要求。

也许你应该尝试在paint/photoshop中将图像大小调整为与404:192具有相同高度/宽度比例的尺寸,并查看是否有帮助。

2

如果您将display: block添加到图像样式中,它将被修复。

<img src="//placehold.it/404x192" style="width:404px; height:192px; display: block" /> 

The first answer should help you to understand why


编辑:其实,你不需要什么,但显示块和图像大小。

相关问题