search

Home  >  Q&A  >  body text

Gmail background color not working properly in HTML mail

<p>August 2023 - Does anyone have a simple example of creating a background color with the entire message body that works in Gmail? I've looked everywhere and as of August 2023, not a single code example works in Gmail. Hopefully someone can share a small snippet from <body> to </body> that works in Gmail as of August 2023. I will be forever grateful. </p> <p>I tried countless options and absolutely none of them worked. </p>
P粉344355715P粉344355715497 days ago449

reply all(1)I'll reply

  • P粉155128211

    P粉1551282112023-08-17 13:04:09

    Hope this helps:

    <!-- width: calc((480px - 100%) * 480); -->
    <table cellpadding="0" cellspacing="0" style="margin:auto; max-width:600px; width: 100%; font-size: 0; border-collapse: collapse;">
        <tr>
            <td>
                <h1 style="margin: 0; padding: 0; font-size: 30px; text-align:center; background: #e1c18b; color: #643c33; line-height: 2;">与我自拍</h1>
            </td>
        </tr>
        <tr>
            <td>
                <img src="https://image.freepik.com/free-photo/camera-mirror_446-19322773.jpg" style="max-width: 100%; display: inline-block; vertical-align:top;" alt="Hero Image" />
            </td>
        </tr>
        <tr>
            <td style="background: #322421;">
                <table cellpadding="10" cellspacing="0" style="width: calc((480px - 100%) * 480); min-width: 50%; max-width: 100%;  font-family: arial; font-size: 14px; display: inline-block;">
                    <tr>
                        <td>
                            <img src="https://image.freepik.com/free-photo/young-hipster-woman-making-photos-with-vintage-film-camera-at-summer-field-women-lifestyle-concept_1150-1054.jpg" alt="" style="width: 100%; display: inline-block; vertical-align: top;" />
                            <p style="padding: 10px 0; margin: 0; text-align: justify; color: #f6e2c0;">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Nostrum praesentium ipsa vero consequuntur sunt porro vitae, a sed fuga debitis ratione, quas mollitia voluptate, ad voluptatum repellat voluptates! At, doloribus.</p>
                        </td>
                    </tr>
                </table>
                <table cellpadding="10" cellspacing="0" style="width: calc((480px - 100%) * 480); min-width: 50%; max-width: 100%;  font-family: arial; font-size: 14px; display: inline-block;">
                    <tr>
                        <td>
                            <img src="https://image.freepik.com/free-photo/young-hipster-woman-making-photos-with-vintage-film-camera-at-summer-field-women-lifestyle-concept_1150-1054.jpg" alt="" style="width: 100%; display: inline-block; vertical-align: top;">
                            <p style="padding: 10px 0; margin: 0; text-align: justify; color: #f6e2c0;">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Nostrum praesentium ipsa vero consequuntur sunt porro vitae, a sed fuga debitis ratione, quas mollitia voluptate, ad voluptatum repellat voluptates! At, doloribus.</p>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td style="margin: 0; padding: 10px; font-size: 20px; text-align:center; background: #564037; color: #ffffff;">
                成为自拍专家
            </td>
        </tr>
    </table>

    reply
    0
  • Cancelreply