html - 无法将 HTML 页脚拉伸到全宽
问题描述
我使用表格制作了一个 HTML 电子邮件布局,该设计在我的机器上运行良好,但是当我将代码放入putsmail中进行测试时,当我在桌面查看邮件时,页脚向左移动。它应该是这样的:
我的 HTML 代码:
<!--Footer-->
<table class="footer">
<tr>
<td style="padding: 50px;background-color: #f7f7f7">
<table width="100%">
<p style="text-align: center; font-size: 12px; line-height: 1.5;">
Having Trouble with something?
<br>
Reach out to us <a href="#">support@vantagecircle.com</a>
</p>
<img style="display: block; margin-right: auto;margin-left: auto; padding-bottom: 25px;" src="https://i.ibb.co/1Z05xTH/vc-footer-logo.png" width="120px" />
</table>
</td>
</tr>
</table>
我的 CSS 代码:
.footer{
align-content: center;
width: max-content;
position: relative;
}
先感谢您
解决方案
将内联 CSS 用于电子邮件模板更安全,我也不认为任何电子邮件客户端支持该align-content
属性,甚至不max-content
支持width
. 也许试试这样:
<table width="100%">
<tr width="100%">
<td style="padding: 50px;background-color:#f7f7f7">
<div style="margin-left:auto;margin-right:auto;">
<p style="text-align: center; font-size: 12px; line-height: 1.5;">
Having Trouble with something?
<br>
Reach out to us <a href="#">support@vantagecircle.com</a>
</p>
<img style="display: block; margin-right: auto;margin-left: auto; padding-bottom: 25px;" src="https://i.ibb.co/1Z05xTH/vc-footer-logo.png" width="120px" />
</div>
</td>
</tr>
</table>
请注意,我在width
那里使用内联,并div
在内部添加了一个td
以与中心对齐。
推荐阅读
- javascript - 使用 Fabric js 调整高清图像大小
- python - 使用 for 循环删除数据帧行
- attributes - header.php wordpress 中隐藏的混合内容
- powershell - 如何使用 powershell 和 Orchestrator 2016 连接到 microsoftTeams?
- node.js - 使用 mongoose 将对象附加到 mongoDB 中的对象数组
- visual-studio-code - 自动完成插件 Visual Studio Code 以灰色插入字符串
- python - 没有这样的表:accounts_demandplan
- swift - 如何获取导航控制器的父序列的引用?
- laravel - Docker 获取 dpkg:安装 ubuntu 映像时出现不可恢复的致命错误
- python - 限制拟合时间