移动视图上的折叠电子邮件列而无需复制代码

发布于 2025-01-28 01:01:36 字数 308 浏览 5 评论 0 原文

目的是拥有2个不同的电子邮件布局 - 一个用于移动设备,一个用于桌面。桌面版本具有2列,在移动版本中,内容应崩溃为1列(如移动视图)。重要的是,如果块是不同的高度,则左侧边框对它们俩的高度相同。 尽可能少的代码重复代码重复,否则电子邮件的大小太大也很重要。

The goal is to have 2 diferrent email layouts - one for mobile and one for desktop. The desktop version has 2 columns and in the mobile version the content should collapse to only 1 column (like in pictures below desktop view, mobile view). It’s important that if the blocks are different heights the border on the left is the same height for both of them.
It’s also important to have as little code duplication between the mobile and desktop views as possible otherwise the email size would be too large.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

心头的小情儿 2025-02-04 01:01:36

您可以使用Flexbox。

最小宽度设置为卡片,并设置显示:flex 到包含的父。并设置 flex-wrap:wrap

示例:
codepen

PS:忽略codepen中的JS部分

You can use flexbox.

set min-width to the cards and set display: flex to parent contained. and set flex-wrap: wrap

Example:
Codepen

PS: Ignore JS Part in the Codepen

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文