web-dev-qa-db-ja.com

メールマガジンの場合、インラインコードを減らすためにダブルbrタグを使用する必要がありますか?

<span>または<p>タグを使用してインラインでスタイリングしているので、実際に古い学校に行って、それぞれ<br><br>タグを閉じて再度開くのではなく、<p>を使用して段落を分割する必要があります。時間?

たとえば、これは私が現在持っているコードのスニペットであり、非常に冗長です。それがインラインでコーディングしなければならない性質であることは知っていますが、<br><br>を実行することでノイズを減らすことができるようです。

<p style="font-size: small; font-family:Tahoma, Geneva, sans-serif">Selection of the 200 New &amp; Recently updated companies over the last month. Click on the company name for up-to-date business information.</p>
<p style="font-size: small; font-family:Tahoma, Geneva, sans-serif">Company Name, FL provider of Category was updated on 2/12/2013</p>
<p style="font-size: small; font-family:Tahoma, Geneva, sans-serif">Company Name, TX provider of Category was updated on 2/13/2013</p>
<p style="font-size: small; font-family:Tahoma, Geneva, sans-serif">Company Name, AK provider of Category was updated on 2/15/2013</p>

<br><br>に適用できる場合、これの一部を切り替えることの欠点はありますか?電子メールクライアントサポートまたはそのようなもの?

15
Ryan

改行タグを自由に使用してください。この方法でマークアップを減らす可能性をすでに正しく特定しており、これを行うことに不利な点はありません。すべての電子メールクライアントとWebクライアントがそれらをサポートしており、すべてのシステムでマージンが包括的にサポートされているわけではないため、段落タグにマージンを使用するよりも信頼性が高くなります。

参照: http://www.campaignmonitor.com/css/

11
niaccurshi

すべてのテキストの間に二重の<br>タグを使用します。これは、電子メールにとって最も一貫性のあるオプションです。

一部のクライアント(Outlookだと思います)ではテキストの上部と下部で空の行を圧縮しますが、&nbsp;とペアリングする必要があります。次に例を示します。

<td>
&nbsp;<br>
The no break space is needed above and below the text where it meets the table cell.
<br><br>
double br's between paragraphs are the best way to do it.
<br><br>
You need 1 no break space per line at the bottom (and top) so that Outlook doesn't remove the text row.
<br>&nbsp;<br>&nbsp;
</td>

これが最も速い方法ですが、行の高さの倍数に制限されます。別のオプションは、パディングを使用することです。

<td style="padding-top:15px; padding-bottom:30px;">
The no break space is needed above and below the text where it meets the table cell.
<br><br>
double br's between paragraphs are the best way to do it.
<br><br>
You need 1 no break space per line at the bottom (and top) so that Outlook doesn't remove the text row.
</td>

行の高さが15pxに設定されていると仮定すると、これらの方法はどちらも同じ結果を生成し、すべての主要な電子メールクライアントで広くサポートされています。

5
John