首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >没有Flexbox的电子邮件HTML通讯中的图像垂直对齐

没有Flexbox的电子邮件HTML通讯中的图像垂直对齐
EN

Stack Overflow用户
提问于 2022-10-03 21:56:55
回答 1查看 45关注 0票数 0

我正在工作的HTML电子邮件通讯。我已经通过各种表和内联CSS将布局分割开来。如果您访问https://heathology.github.io/email-newsletter/,您可以看到我的时事通讯的现场演示。

有一张图片写着“恐怖之夜”,它是两列中的第一列.我想把图像垂直地放在第2列的内容旁边。我不能让图像向下跳动。

下面,您将看到我的css代码:

代码语言:javascript
复制
/* two columns */
    .two-columns.last {
        padding: 15px 0;
    }
    .two-columns .padding {
        padding: 20px;
    }
    .two-columns .content {
        font-size: 15px;
        line-height: 20px;
        text-align: left;
    }
    .button {
        background-color: #ffffff;
        color: #171a1b;
        text-decoration: none;
        padding: 12px 20px;
        border-radius: 5px;
        font-weight: bold;
    }
    .button-dark {
        background-color: #171a1b;
        color: #ffffff;
        text-decoration: none;
        padding: 12px 20px;
        border-radius: 5px;
        font-weight: bold;
    }

在下面的HTML中,您可以看到我是如何通过表安排它的:

代码语言:javascript
复制
<!-- TWO COLUMN SECTION -->
            <tr>
                <td style="background-color: #26292b; color: #ffffff;">
                    <table width="100%">

                        <tr>
                            <td class="two-columns last">

                                <table class="column">
                                    <tr>
                                        <td class="padding">
                                            
                                            <table class="content">
                                                <tr>
                                                    <td>
                                                        <a href="LINK"><img src="img/2022-Fright-Night.png" alt="" width="260" style="max-width:260px;"></a>
                                                    </td>
                                                </tr>
                                            </table>
                                        </td>
                                    </tr>
                                </table>

                                <table class="column">
                                    <tr>
                                        <td class="padding">
                                
                                            <table class="content">
                                                <tr>
                                                    <td>
                                                        <p style="font-weight: bold; font-size: 18px;">Fright Night</p>
                                                        <p style="padding-bottom: 16px;">Do you like chills and fright? Then, join St. Auggies' youth at Frontier City's Fright Night on Friday, October 28 from
                                                        6:00pm-10:00pm. Tickets are $42.99/per person. Open to youth and adults 12 & up.</p>
                                                            <a href="LINK" class="button">Sign Up</a>
                                                    </td>
                                                </tr>
                                            </table>
                                        </td>
                                    </tr>
                                </table>

                            </td>
                        </tr>

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

有什么建议吗?如果需要,您可以看到完整的代码这里

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-10-03 22:08:51

更改.两列.column的css样式

代码语言:javascript
复制
    width: 100%;
    max-width: 300px;
    display: inline-block;
    vertical-align: middle;
    text-align: center;
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/73941216

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档