gpt4 book ai didi

html - 如何使用 css 使文本与其下方的单元格对齐?

转载 作者:太空宇宙 更新时间:2023-11-04 13:12:39 25 4
gpt4 key购买 nike

我正在设计一封电子邮件,但我不确定如何使文本与其下方的行对齐。我想要“我们的天气专家”和“正在寻找您”。横跨表格并与其下方包含段落和了解更多按钮的行齐平。我尝试使用字母间距和不同种类的填充,但这有可能吗?

它应该是这样的:

enter image description here

我还尝试将“Our Weather Experts”行设为瘦文本,但 font-weight: lighter 属性似乎也不起作用。

如有任何帮助,我们将不胜感激。

<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<style type="text/css">

.borderbottom {border-bottom: 1px solid #dadada;}
.innerpadding {padding: 30px 30px 30px 30px;}

/* CLIENT-SPECIFIC STYLES */
#outlook a{padding:0;} /* Force Outlook to provide a "view in browser" message */
.ReadMsgBody{width:100%;} .ExternalClass{width:100%;} /* Force Hotmail to display emails at full width */
.ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td, .ExternalClass div {line-height: 100%;} /* Force Hotmail to display normal line spacing */
body, table, td, a{-webkit-text-size-adjust:100%; -ms-text-size-adjust:100%;} /* Prevent WebKit and Windows mobile changing default text sizes */
table, td{mso-table-lspace:0pt; mso-table-rspace:0pt;} /* Remove spacing between tables in Outlook 2007 and up */
img{-ms-interpolation-mode:bicubic;} /* Allow smoother rendering of resized image in Internet Explorer */

/* RESET STYLES */
body{margin:0; padding:0;}
img{border:0; height:auto; line-height:100%; outline:none; text-decoration:none;}
table{border-collapse:collapse !important;}
body{height:100% !important; margin:0; padding:0; width:100% !important;}

/* iOS BLUE LINKS */
.appleBody a {color:#68440a; text-decoration: none;}
.appleFooter a {color:#999999; text-decoration: none;}


</style>
</head>
<body yahoo="fix" style="margin: 0; padding: 0; ">
<table class="container" width="640" align="center" cellpadding="0" cellspacing="0" border="0" style="margin: 0 auto; padding: 0;">
<tr>
<td valign="top" align="center" bgcolor="#ffffff">
<div class="mobile-only" style="text-indent: -99999em; display: none; height: 0; width: 0; overflow: hidden; max-height: 0;">
<img src="http://image.email-libertymutual.com/lib/fe6a15707464047f7c1c/m/1/CatAuto-Header-Mobile-320x159.jpgg" border="0">
</div>
<div class="no-mobile">
<img src="http://image.email-libertymutual.com/lib/fe6a15707464047f7c1c/m/1/CatAuto-Header-Desktop-640x220.jpg" border="0">
</div>
</td>
</tr>
<tr>
<td valign="top" align="center" bgcolor="#ffffff" style="padding:30px;" >
<table cellpadding="0" cellspacing="0" border="0" width="600">
<tr>
<td colspan="2" style="letter-spacing: 3px; font-family: Arial, Helvetica, sans-serif; font-size:43px; color: #002663">
OUR WEATHER EXPERTS
</td>
</tr>
<tr>
<td colspan="2" style="letter-spacing: 3px; font-family: Arial, Helvetica, sans-serif; font-size:36px; color: #002663">
<strong>ARE LOOKING OUT FOR YOU.</strong>
</td>
</tr>
<tr>
<td style="font-family: Arial, Helvetica, sans-serif; font-size:16px; color:#666666; line-height:20px; padding:20px 35px 25px 0px;" align="left" class="borderbottom">
Your area is likely to receive severe storms in the upcoming months. We've prepared information and tips to help protect you and your loved ones this season.
</td>
<td style="font-family: Arial, Helvetica, sans-serif; vertical-align:top; padding: 20px 0px 30px 0px"; align="left" class="borderbottom">
<a href="#"><img src="http://image.email-libertymutual.com/lib/fe6a15707464047f7c1c/m/1/CatAuto-Button-Learn-More-139x38.jpg" style="display:block;" width="139" height="38"></a>
</td>
</tr>
</table>
</td>
</tr>
</table>

</body>
</html>

最佳答案

你想做的是

text-align:justify;

但只有一行文本会变得有点困惑。

您需要添加一个宽度为 100% 的空容器,以将文本推到最后。

<span style="display:inline-block;width:100%;"></span>

然后它会在文本下方添加额外的空间,因此您需要调整行高。

参见 fiddle https://jsfiddle.net/y7vp8oz0/

关于html - 如何使用 css 使文本与其下方的单元格对齐?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31395110/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com