【问题标题】:Space between td's in my table?我表中 td 之间的空格?
【发布时间】:2013-10-25 09:57:35
【问题描述】:

我创建了一封电子邮件以发送给当前订阅的客户,它的图像很重,所以它是在表格中创建的,它预览得很好,但是一旦我将它插入到雅虎邮件消息中或通过电子邮件客户端到我的雅虎邮件,每一行在底部有大约 10 像素的边距/填充,将图像分开。

几个小时以来,我一直在疯狂尝试我能找到的任何东西,所以我想我会上传自己的代码,看看是否有人可以帮助我:)

    <table style="margin:0 auto; border-collapse: collapse; border-spacing: 0;" cellpadding="0" cellspacing="0" width="566">
    <th style="border:none;padding:0;margin:0;" ><p style="float:left; padding-left:10px;font-size:9px; text-align:center; color:#999999; text-decoration:none;"><a style="color:#999999;" href="http://www.purecollection.com/pages/be-inspired">Shop contemporary Design with 10% off plus free delivery and free returns</a></p></th>
    <tr style="border:none;padding:0;margin:0;">
    <td> <a href="http://www.purecollection.com/default.aspx"><img src="http://images.mailermailer.com/image/50064636L/148258/o/2.png"/></a></td></tr>
    <tr style="border:none;padding:0;margin:0;"><td><img src="http://images.mailermailer.com/image/50064636L/148259/o/3.png"/></td></tr>
    <tr style="border:none;padding:0;margin:0;"><td><a href="http://www.emagcloud.com/aw12-hosting/UK_Autumn_Main_Book/index.html" style="margin:0;padding:0; "><img style="margin:0;padding:0; border:none;" src="http://images.mailermailer.com/image/50064636L/148260/o/4.png" alt="View our Autumn E-Catalogue"/></a><img style="margin:0;padding:0; border:none;" src="http://images.mailermailer.com/image/50064636L/148328/o/5.png"/></td></tr>
    <tr style="border:none;padding:0;margin:0;"><td><a href="http://www.purecollection.com/pages/style-guide"><img style="margin:0;padding:0; border:none;" src="http://images.mailermailer.com/image/50064636L/148262/o/6.png" alt="BE INSPIRED - Style guide"/></a><a href="http://www.purecollection.com/pages/be-inspired"><img style="margin:0;padding:0; border:none;" src="http://images.mailermailer.com/image/50064636L/148263/o/7.png" alt"View our be inspired collection"/></a></td></tr>
    <tr style="border:none;padding:0;margin:0;"><td><a href="http://www.purecollection.com/default.aspx"><img style="margin:0;padding:0; border:none;" src="http://images.mailermailer.com/image/50064636L/148321/o/8.png"/></a></td></tr>
    <tr><td><a href="http://www.purecollection.com/info/static.aspx?page=newsletter&email="><img style="margin:0;padding:0; border:none;" src="http://images.mailermailer.com/image/50064636L/148322/o/9.png" alt="send this to a friend"/></a><a href="http://www.purecollection.com/pages/requestcatalogue"><img style="margin:0;padding:0; border:none;" src="http://images.mailermailer.com/image/50064636L/148323/o/10.png" alt="request a catalouge"/></a><a href="http://www.purecollection.com/pages/christinanoblechildrensfoundation#page=page-1"><img style="margin:0;padding:0; border:none;" src="http://images.mailermailer.com/image/50064636L/148324/o/11.png" alt="Christina Noble Children's Foundation"/></a><a href="http://example.com/maps/Asbxy"><img style="margin:0;padding:0; border:none;" src="http://images.mailermailer.com/image/50064636L/148325/o/12.png" alt="find out UK stores"/></a><a href="https://www.facebook.com/PureCollection"><img style="margin:0;padding:0; border:none;" src="http://images.mailermailer.com/image/50064636L/148326/o/13.png" alt="join us on facebook"/></a><a href="https://twitter.com/PureCollection"><img style="margin:0;padding:0; border:none;" src="http://images.mailermailer.com/image/50064636L/148327/o/14.png" alt="follow us on twitter"/></a></td></tr>
    <tr><td>
      <p style="font-size:9px; text-align:center; color:#999999;"></ br>Terms and Conditions: 1 Your offer code = AW13KAS 2. This offer code will be automatically added into your shopping basket. 3. Offer expires midnight 7th October 2013. 4 Cannot be used in conjunction with any other offer. 5. Offer does not apply to gift vouchers. 6. No adjustments prior purchases. 8. 10% off includes free delivery and free returns. 9. Free delivery applies to standard UK delivery £4.95.</p>
      <p style="font-size:9px; text-align:center; color:#999999;"></ br>Please add purecollection@news.purecollection.com to your address book to ensure our emails reach your inbox. If you received this email from a friend and would like to subscribe to our newsletter. <a style="color:#999999;" href="http://www.purecollection.com/info/static.aspx?page=newsletter&email=">click here</a>
      <p style="font-size:9px; text-align:center; color:#999999;"></ br>Pure Collection LTD | Mowbray House | Mowbray Square | Harrogate | HG1 5AU | 0844 848 1030</p>
  <p style="font-size:9px; text-align:center; color:#999999;"><a style="color:#999999;" href="http://www.purecollection.com/pages/securityandprivacy"></ br>Privacy</a></p></td></tr>
</table>

【问题讨论】:

  • 嘿,只是好奇,这是在答案之一的帮助下解决的吗?

标签: html-table html-email margin padding


【解决方案1】:

哦,你这个可怜的灵魂。当程序员添加内联样式时,你可以看出他很生气。这只是混乱。

恐怕你不会很喜欢这个答案,它只有一行代码。干得好: http://jsfiddle.net/w5MJM/

td img {
    vertical-align:top;
}

【讨论】:

    【解决方案2】:

    我经历过类似的事情,请在您的图片中添加display: block;。希望这会有所帮助

    【讨论】:

    • 一开始我也是这么想的。但是,他在每一行都有一些图像.. 使用 display:block;会将它们全部推到单独的行中。
    • 我没有注意到这个细节,然后display: block; 会工作,如果在同一个td 上没有多个图像的话
    猜你喜欢
    • 1970-01-01
    • 2015-03-12
    • 1970-01-01
    • 2018-09-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-01-05
    • 1970-01-01
    相关资源
    最近更新 更多