简体   繁体   English

HTML中的边框底部未显示

[英]Border Bottom in HTML not showing up

I am trying to do an email with HTML design on VB.Net but the border bottom doesn't show up and I don't see anything wrong with the code. 我正在尝试在VB.Net上使用HTML设计制作电子邮件,但是边框底部没有显示出来,并且我看不到代码有什么问题。

You can see here that the border bottom is not showing : 您可以在此处看到边框底部未显示:

在此处输入图片说明

Expected Border Bottom should be like this with a little gray line at the bottom : 预期的边界底部应该是这样的,底部有一点灰线:

在此处输入图片说明

Here is my code for the border bottom : 这是我的边框底部代码:

                    mm.Body = mm.Body & "<tbody><tr>"
                    mm.Body = mm.Body & "<td style=min-height:65px;background-color:#000000;border-bottom:1px solid #4d4b48;>"
                    mm.Body = mm.Body & "<img src=https://image.ibb.co/gf2547/Email_Header_PNG.png width=538 height=65 alt=Steam>"
                    mm.Body = mm.Body & "</td>"
                    mm.Body = mm.Body & "</tr>"

You can check my entire HTML code for the whole email here : 您可以在这里查看我整个HTML代码中的整个电子邮件:

                    mm.Body = mm.Body & "<div>"
                    mm.Body = mm.Body & "<table style=width:538px;background-color:#393836; align=center cellspacing=0 cellpadding=0>"


                    mm.Body = mm.Body & "<tbody><tr>"
                    mm.Body = mm.Body & "<td style=min-height:65px;background-color:#000000;border-bottom:1px solid #4d4b48;>"
                    mm.Body = mm.Body & "<img src=https://image.ibb.co/gf2547/Email_Header_PNG.png width=538 height=65 alt=Steam>"
                    mm.Body = mm.Body & "</td>"
                    mm.Body = mm.Body & "</tr>"


                    mm.Body = mm.Body & "<tr>"
                    mm.Body = mm.Body & "<td bgcolor=#370E0E>"
                    mm.Body = mm.Body & "<table width=470 border=0 align=center cellpadding=0 cellspacing=0 style=padding-left:5px;padding-right:5px;padding-bottom:10px;>"
                    mm.Body = mm.Body & "<tbody><tr bgcolor=#370E0E>"
                    mm.Body = mm.Body & "<td style=padding-top:32px;>"
                    mm.Body = mm.Body & "<font color=#F12121> <h1> Dear " + firstname + " " + lastname + ", </h1> </font>"
                    mm.Body = mm.Body & "</td>"
                    mm.Body = mm.Body & "</tr>"
                    mm.Body = mm.Body & "<tr>"
                    mm.Body = mm.Body & "<td style=padding-top:12px;>"
                    mm.Body = mm.Body & "<font color=#c6d4df> <h3> The Newly Generated Password you need to login into your account is : </h3> </font>"
                    mm.Body = mm.Body & "</td>"
                    mm.Body = mm.Body & "</tr>"
                    mm.Body = mm.Body & "<tr>"
                    mm.Body = mm.Body & "<td>"
                    mm.Body = mm.Body & "<div>"
                    mm.Body = mm.Body & "<font color=#F12121> <h1> " + lbl1.Text + " </h1> </font>"
                    mm.Body = mm.Body & "</div>"
                    mm.Body = mm.Body & "</td>"
                    mm.Body = mm.Body & "</tr>"
                    mm.Body = mm.Body & "<tr bgcolor=#2A0808>"
                    mm.Body = mm.Body & "<td style=padding:20px;font-size:12px;line-height:17px;color:#c6d4df; font-family:Arial, Helvetica, sans-serif;>"
                    mm.Body = mm.Body & "<p style=padding-bottom:10px;color:#c6d4df;>This Email and Password was generated upon your request. The Verification Attempt included your correct Umbrella ID and Email.</p>"
                    mm.Body = mm.Body & "<p style=padding-bottom:10px;color:#c6d4df;>The Generated Password is required to complete the login.  <span style=color:#ffffff;font-weight:bold;>No one can access your account without also accessing this email.</span></p>"
                    mm.Body = mm.Body & "<p style=padding-bottom:10px;color:#c6d4df;><span style=color:#ffffff;font-weight:bold;>If you are not attempting to login</span> then please change your Umbrella Account password and consider changing your email password as well to ensure your account security.</p>"
                    mm.Body = mm.Body & "<p style=padding-top:10px;color:#61696d;>If you are unable to access your account then you may choose to <a rel=nofollow style=color:#8f98a0; target=_blank href=https://help.steampowered.com/#HelpUnauthorizedLogin?stoken=PbSXLaCZRzquMH0O2wIxCSPQlkzzZ%2BYDb0OWGxQEIhILTU1sRh69ojyLplpI6nFD8cPAAi0E59y0hViMAOj9ekVlQX0ekbDB0fKFEYzrO1M%3D> lock your account.</"
                    mm.Body = mm.Body & "a> Once locked you must request <a rel=nofollow style=color:#8f98a0; target=_blank href=https://support.steampowered.com/newticket.php?category=11> Umbrella Support's Assistance </"
                    mm.Body = mm.Body & "a> in recovering and unlocking it.  Until the account is unlocked you will be restricted from accessing any of the Umbrella Corporation's Property and will be held in Solitary Confinement.</p>"
                    mm.Body = mm.Body & "</td>"
                    mm.Body = mm.Body & "</tr>"
                    mm.Body = mm.Body & "<tr>"
                    mm.Body = mm.Body & "<td style=font-size:12px;color:#6d7880;padding-top:16px;padding-bottom:60px;>"
                    mm.Body = mm.Body & "Umbrella Corporation Personnel Security Observation Team<br>"
                    mm.Body = mm.Body & "<a rel=nofollow style=color:#8f98a0; target=_blank href=https://help.steampowered.com/>https://support.umbrellacorp.uc </a><br>"
                    mm.Body = mm.Body & "</td>"
                    mm.Body = mm.Body & "</tr>"
                    mm.Body = mm.Body & "</tbody></table>"
                    mm.Body = mm.Body & "</td>"
                    mm.Body = mm.Body & "</tr>"
                    mm.Body = mm.Body & "<tr style=background-color:#000000;>"
                    mm.Body = mm.Body & "<td style=padding:12px 24px;>"
                    mm.Body = mm.Body & "<table cellpadding=0 cellspacing=0>"
                    mm.Body = mm.Body & "<tbody><tr>"
                    mm.Body = mm.Body & "<td width=92>"
                    mm.Body = mm.Body & "<img src=https://image.ibb.co/krMnHS/Email_Footer_2_PNG.png width=92 height=26 alt=Valve®>"
                    mm.Body = mm.Body & "</td>"
                    mm.Body = mm.Body & "<td style=font-size:11px;color:#595959;padding-left:12px;>Umbrella Corporation. PO Box 1688 Bellevue, WA 98009.<br> "
                    mm.Body = mm.Body & "All rights reserved. All trademarks are property of their respective owners in the US and other countries. <br>"
                    mm.Body = mm.Body & "</td>"
                    mm.Body = mm.Body & "</tr>"
                    mm.Body = mm.Body & "</tbody></table>"
                    mm.Body = mm.Body & "</td>"
                    mm.Body = mm.Body & "</tr>"
                    mm.Body = mm.Body & "</tbody></table>"
                    mm.Body = mm.Body & "</div>"

You need to put quotations around the attribute values in your markup, eg: 您需要在标记中的属性值两边加上引号,例如:

mm.Body = mm.Body & "<td style=""min-height:65px;background-color:#000000;border-bottom:1px solid #4d4b48;"">"

Repeat that for all of the other attributes in your code, style or otherwise. 对代码, style或其他方面的所有其他属性重复该操作。

Without the quotations, you have invalid HTML markup, and at best, whatever is parsing your HTML markup is giving up after it sees the first invalid attribute value character (probably the - or : in this case), resulting in that entire style attribute basically being ignored. 如果没有报价,你有无效的HTML标记,并在最好的,无论是解析您的HTML标记放弃它看到后的第一属性值无效字符(可能是-或者:在这种情况下),导致整个style属性基本上被忽略了。

Given that e-mail HTML is already extremely finicky, you should ensure that your markup is as valid as you can make it. 鉴于电子邮件HTML已经非常挑剔,因此您应该确保您的标记尽可能有效。

Lastly, for maintainability, I would suggest somehow storing your HTML with replaceable tokens or something and replacing them in your VB.NET code. 最后,出于可维护性考虑,我建议以某种方式存储带有可替换标记或其他内容的HTML,并将其替换为VB.NET代码。 Piecing tags together line by line doesn't help with spotting errors in your markup such as a missing end tag. 逐行将标签拼接在一起并不能帮助您发现标记中的错误,例如缺少结束标签。 It also prevents you from making changes to the layout without having to recompile your code. 它还可以防止您更改布局而不必重新编译代码。

Your cell height is shorter than your image + border. 您的单元格高度短于图像+边框。 Try a min-height of 67px on the td or make the img height 63 pixels (at least to test). 尝试在td上将最小高度设置为67px,或将img高度设置为63像素(至少要进行测试)。

If that doesn't work, try a 1px padding on your td . 如果这样不起作用,请在您的td上尝试使用1px的填充。

Are you sure that your <tbody> tags are inside a <table> tag? 您确定<tbody>标签位于<table>标签内吗?

    <table>
      <tr>
        <td >
          <img src=https://image.ibb.co/gf2547/Email_Header_PNG.png width=538 height=65 alt=Steam>
        </td>
      </tr>
    </table>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM