国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

Table of Contents
Mail layout mode
Single-column layout
Multi-column layout requires rearrangement of the columns as the device width decreases. Whether you use two, three, or more columns, you need to display them vertically instead of horizontally.
Email combinations usually require the use of nested tables. This is always considered the best way to ensure client compatibility, but on the other hand, the generated code is very confusing and actually difficult to read.
Change the display property of a table cell
About Images
Conclusion
Resources
Frequently Asked Questions about Building Responsive Mail
Home Technology peripherals It Industry A Box of Tricks for Building Responsive Email

A Box of Tricks for Building Responsive Email

Feb 21, 2025 am 10:37 AM

Responsive Mail Design Guide: Make your emails perfectly present on a variety of devices

Core points

  • As mobile devices become popular in email reading, responsive mail layout must take into account the characteristics of mobile devices. This requires rearranging the mail content, and arranging the originally horizontally-arranged cells vertically on the mobile device.
  • Single-column mail layout (usually containing a single title image) does not require rearranging elements, just adjust the width to match the device size. This is a scalable design rather than a responsive design.
  • Multi-column mail layout needs to rearrange the columns as the device width decreases. This can be achieved by using nested tables or changing the display property of the table cell. The latter is more elegant and uses native CSS rules.
  • Images in responsive emails only require classic responsive technology (img {max-width: 100%;}). However, using media queries, one image can be hidden and another image can be used instead as the background image.

A Box of Tricks for Building Responsive Email

Picture provided by: fishbulb1022

In previous articles about press release writing, we have learned some tips that can greatly change how your emails appear in different clients.

In addition, we must consider mobile devices, which are increasingly used in email reading. This raises the problem of building responsive layouts for emails.

Since we know that email templates are built with HTML tables and have inline CSS, our work is a little more complicated than usual:

  • Inline CSS rules have high specificity values ??(they always win).
  • Tables are not designed for layout combinations, so we must pay attention to the combination of emails and remember that cells (natural horizontal positioning) should be arranged vertically on mobile devices.
  • Of course, we cannot use JavaScript.

Luckily, most mobile devices have high compatibility with modern CSS rules, so we can easily solve all of these problems with media queries, use a lot of !important declarations (to override inline styles), and Pay attention to the arrangement of contents carefully.

For such projects, it is important to adopt a "mobile-first" approach, avoiding layouts that cannot be arranged correctly on small devices.

Please note that even in this article we only discuss responsive issues, responsive mobile mail is not necessarily a good mail. Effective mobile email design involves many elements, including font size, layout combinations, and more: these are very important tasks, which we will cover in another article.

Mail layout mode

About responsiveness, we can identify two types of mail: single column and multiple columns.

Single-column layout

Single-column layout (usually only one title image) has no special needs. Since they don't need to rearrange elements, we just need to note that all widths are elegantly downgraded to match device sizes. This is not a responsive design, but a classic example of a scalable design (see Scalable, Fluid, or Responsive: Understanding how to move mail).

Single-column layoutA Box of Tricks for Building Responsive Email

To ensure that your email is resized correctly, you just need to adjust the table width:

<table> cellspacing="0" cellpadding="0" border="0" width="600">

</table>
You also need to resize the image (see the "About Image" paragraph at the end of this article) and resize the font, but there are no other special needs.
@media screen and (max-width:480px) {
    table {
        width: 100%!important;
    }
}

Multi-column layout

Multi-column layout requires rearrangement of the columns as the device width decreases. Whether you use two, three, or more columns, you need to display them vertically instead of horizontally.

A Box of Tricks for Building Responsive Email There are two simple ways to achieve this:

Using nested tables
  1. Change the
  2. property of the table cell.
  3. display
  4. Nested table layout

Email combinations usually require the use of nested tables. This is always considered the best way to ensure client compatibility, but on the other hand, the generated code is very confusing and actually difficult to read.

The trick is to use the

attribute, which causes the table to be horizontally aligned.

Each element must have a table align="left"specific

width, and their sum must be the same as their container value.

When the device width decreases, we have to resize the container and force all table columns to 100% width. A Box of Tricks for Building Responsive Email

This technique ensures compatibility with most clients: I tested the demo files in Litmus and all clients get good results, allowing the following warning:

table[class="body_table"] {
    width: 600px;
}

table[class="column_table"] {
    width: 180px;
}

table[class="spacer_table"] {
    width: 30px;
    height:30px;
}

@media only screen and (max-width: 480px) {
    table[class="body_table"] {
        width: 420px!important;
    }
    table[class="column_table"] {
        width: 100%!important;
    }
}

Outlook 2007, 2010, and 2013 (these versions of Outlook use Microsoft Word as the rendering engine: see the Microsoft Outlook Client Rendering Difference Guide on the Litmus blog);

    The oldest version of Lotus Notes;
  • Gmail Android app.
  • This is a good starting point (see below for some of the results of the test), we must also consider that this test is built with empty tables: Add content (and more nested tables!!) You should be able to fix it All errors and make this technology work properly with all clients.

Part of Litmus Compatibility Test Results

A Box of Tricks for Building Responsive Email

Change the display property of a table cell

The second method of building multi-column messages is more elegant and uses native CSS rules.

This technique involves changing the display properties of the default table cell when the device width is reduced (you can find many examples on responsiveemailpatterns.com). This causes cells to re-stack vertically:

A Box of Tricks for Building Responsive Email

Change the display plan

<table> cellspacing="0" cellpadding="0" border="0" width="600">

</table>

The results of this test are very good: all clients render the test mail correctly (sometimes there are subtle errors), but remember that we have tried empty mail and the results may vary after adding content.

About Images

In responsive mail, images only require the classic responsive technology we currently use in the web (img {max-width: 100%;}).

However, as suggested in Campaign Monitor's Responsive Mail Design Guide, using media queries, you can hide one image and replace it with another image as the background image.

@media screen and (max-width:480px) {
    table {
        width: 100%!important;
    }
}

A Box of Tricks for Building Responsive Email

Remember that even images hidden through CSS will load on the client, so be aware of this.

A good option is to use the same image for the img tag and background-image source. You have to prepare a multiple-purpose image for use in all these ranges, like the following example:

A Box of Tricks for Building Responsive Email

After selecting the appropriate image, you can use it for many media query breakpoints. Once you're ready, you only need to add a small amount of CSS rules:

table[class="body_table"] {
    width: 600px;
}

table[class="column_table"] {
    width: 180px;
}

table[class="spacer_table"] {
    width: 30px;
    height:30px;
}

@media only screen and (max-width: 480px) {
    table[class="body_table"] {
        width: 420px!important;
    }
    table[class="column_table"] {
        width: 100%!important;
    }
}

You can also add the background-size attribute to adjust each breakpoint view (note the client's support for this rule).

Unfortunately, this is unlikely to solve all your needs for high-density devices—but it can reduce the number of files loaded for all other cases.

Conclusion

So, is there a single, versatile, and best responsive email creation technology ever?

Usually, the answer is no. Each project requires a different approach and there are different best solutions. The real answer is to master a range of useful techniques and constantly try new methods.

Resources

Frequently Asked Questions about Building Responsive Mail

(The FAQ section provided in the original text is omitted here, because the content of this part is less difficult to rewrite and is longer than other parts of the original text. To avoid too long output, it is omitted here.)

The above is the detailed content of A Box of Tricks for Building Responsive Email. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undress AI Tool

Undress AI Tool

Undress images for free

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

PHP Tutorial
1488
72
Advanced AI models generate up to 50 times more CO₂ emissions than more common LLMs when answering the same questions Advanced AI models generate up to 50 times more CO₂ emissions than more common LLMs when answering the same questions Jul 06, 2025 am 12:37 AM

The more precisely we attempt to make AI models function, the greater their carbon emissions become — with certain prompts generating up to 50 times more carbon dioxide than others, according to a recent study.Reasoning models like Anthropic's Claude

AI 'hallucinates' constantly, but there's a solution AI 'hallucinates' constantly, but there's a solution Jul 07, 2025 am 01:26 AM

The major concern with big tech experimenting with artificial intelligence (AI) isn't that it might dominate humanity. The real issue lies in the persistent inaccuracies of large language models (LLMs) such as Open AI's ChatGPT, Google's Gemini, and

Why is AI halllucinating more frequently, and how can we stop it? Why is AI halllucinating more frequently, and how can we stop it? Jul 08, 2025 am 01:44 AM

The more advanced artificial intelligence (AI) becomes, the more it tends to "hallucinate" and provide false or inaccurate information.According to research by OpenAI, its most recent and powerful reasoning models—o3 and o4-mini—exhibited h

Cutting-edge AI models from OpenAI and DeepSeek undergo 'complete collapse' when problems get too difficult, study reveals Cutting-edge AI models from OpenAI and DeepSeek undergo 'complete collapse' when problems get too difficult, study reveals Jul 07, 2025 am 01:02 AM

Artificial intelligence (AI) reasoning models aren't quite as capable as they appear. In reality, their performance breaks down completely when tasks become too complex, according to researchers at Apple.Reasoning models like Anthropic's Claude, Open

Arrests made in hunt for hackers behind cyber attacks on M&S and Co-op Arrests made in hunt for hackers behind cyber attacks on M&S and Co-op Jul 11, 2025 pm 01:36 PM

The UK’s National Crime Agency (NCA) has arrested four individuals suspected of involvement in the cyber attacks targeting Marks and Spencer (M&S), Co-op, and Harrods.According to a statement, the suspects include two 19-year-old men, a 17-year-o

Post-quantum cryptography is now top of mind for cybersecurity leaders Post-quantum cryptography is now top of mind for cybersecurity leaders Jul 11, 2025 pm 01:38 PM

Post-quantum cryptography has become a top priority for cybersecurity leaders, yet recent research indicates that some organizations are not treating the threat with the seriousness it demands.Quantum computers will eventually be capable of solving t

Ransomware attacks carry huge financial impacts – but CISO worries still aren’t stopping firms from paying out Ransomware attacks carry huge financial impacts – but CISO worries still aren’t stopping firms from paying out Jul 12, 2025 am 12:59 AM

Ransomware attacks bring with them an average recovery cost of $4.5 million, according to a recent survey, which also found that a significant number of businesses have been affected by the malware in the past year.Data collected by Absolute Security

Red Hat is giving developers free access to RHEL – here’s what you need to know Red Hat is giving developers free access to RHEL – here’s what you need to know Jul 13, 2025 am 12:49 AM

Red Hat has introduced a new self-service platform designed to provide easier access to its developer program.The Red Hat Enterprise Linux for Business Developers initiative is intended to assist development teams in building, testing, and deploying

See all articles