【问题标题】:How to change the white sidebar color in html email template如何更改 html 电子邮件模板中的白色侧边栏颜色
【发布时间】:2021-09-18 03:24:42
【问题描述】:

我一直在尝试编辑我的 HTML 电子邮件模板的背景颜色,但我只想更改白色的侧边栏,而不是电子邮件正文的背景。

这是我的 CSS

 <style type="text/css"><style type="text/css">@import url('https://fonts.googleapis.com/css?family=Roboto:400,700');  
    
    }

      ReadMsgBody {
              width: 100%;
            }
            .ExternalClass {
              width: 100%;
            }
            .ExternalClass,
            .ExternalClass p,
            .ExternalClass span,
            .ExternalClass font,
            .ExternalClass td,
            .ExternalClass b,
            .ExternalClass br,
            .ExternalClass img .ExternalClass div {
              line-height: 100%;
            }
            a:link {
              color:  #075792;
              background-color:  transparent;
              text-decoration: underline;
            }
            a:visited {
             color:  #075792;
             background-color:  transparent;
             text-decoration: underline;
      }
a:hover{
color: red;
background-color:transparent;
text-decoration: underline;
      }
            body {
              -webkit-text-size-adjust: 100%;
              -ms-text-size-adjust: 100%;
              margin: 0 !important;
              padding: 0;
            }
            body,
            #body_style {
              background: #fffffe;
              min-height: 1000px;
            }
            p {
              margin: 1em 0;
            }
            table td {
              border-collapse: collapse;
              border-spacing: 0 !important;
            }
            table tr {
              border-collapse: collapse;
              border-spacing: 0 !important
            }
            table tbody {
              border-collapse: collapse;
              border-spacing: 0 !important
            }
            table {
              border-collapse: collapse;
              border-spacing: 0 !important
            }
            span.yshortcuts,
            a span.yshortcuts {
              color: #ffffff;
              background-color: none;
              border: none;
            }
            span.yshortcuts:hover,
            span.yshortcuts:active,
            span.yshortcuts:focus {
              color: #ffffff;
              background-color: none;
              border: none;
            }
            img {
              outline: 0;
              -ms-interpolation-mode: bicubic;
            }
            a img {
              border: none;
            }
            @-ms-viewport {
              width: device-width;
            }
            a[x-apple-data-detectors] {
              color: inherit !important;
              text-decoration: none !important;
              font-size: inherit !important;
              font-family: inherit !important;
              font-weight: inherit !important;
              line-height: inherit !important;
            }
            .yahooNone {
              display: none;
            }
            .view {
              display: none;
            }
            #radio-1:checked~.container .view1,
            #radio-2:checked~.container .view2,
            #radio-3:checked~.container .view3 {
              display: block;
            }
            input {
              opacity: 0;
              position: absolute;
              display: none;
            }
            @media screen and (-webkit-min-device-pixel-ratio: 0) {
              .cbox:checked+.interactive {
                display: block !important;
                max-height: none !important;
              }
              .fallback {
                display: none !important;
              }
              /*   Hide interactive portion from AOL Mail */
              input[class~="aolmail_cbox"]:checked~.interactive {
                display: none !important;
              }
              input[class~="aolmail_cbox"]:checked~.fallback {
                display: block !important;
              }
        <style type="text/css">@media only screen and (max-width: 400px) {
        .container,
        .stack {
          width: 100% !important;
        }
        .footer {
          width: auto !important;
          margin-left: 0;
        }
        .mobile-hidden,
        .noMo {
          display: none !important;
        }
        .logo {
          display: block !important;
          padding: 0 !important;
        }
        img {
          max-width: 100% !important;
          height: auto !important;
          max-height: auto !important;
        }
        .header img {
          max-width: 100% !important;
          height: auto !important;
          max-height: auto !important;
        }
        .photo img {
          width: 100% !important;
          max-width: 100% !important;
          height: auto !important;
        }
        .drop {
          display: block !important;
          width: 100% !important;
          float: left;
          clear: both;
        }
        .footerlogo {
          display: block !important;
          width: 100% !important;
          padding-top: 15px;
          float: left;
          clear: both;
        }
        .nav4,
        .nav5,
        .nav6 {
          display: none !important;
        }
        .tableBlock {
          width: 100% !important;
        }
        .responsive-td {
          width: 100% !important;
          display: block !important;
          padding: 0 !important;
        }
        .fluid,
        .fluid-centered {
          width: 100% !important;
          max-width: 100% !important;
          height: auto !important;
          margin-left: auto !important;
          margin-right: auto !important;
        }
        .responsive-tdbottom {
          width: 100% !important;
          display: block !important;
          text-align: center !important;
          border-bottom: 1px #d2d2d2 solid;
          padding-top: 20px !important;
          border-left: 0px solid #ffffff !important;
        }
        .responsivepadding-td {
          width: 100% !important;
          display: block !important;
          padding-top: 20 !important;
        }
        .fluid-centered {
          margin-left: auto !important;
          margin-right: auto !important;
        }
            }
             /* Your custom styles here */
        .hund {
          width: 100% !important;
          height: auto !important;
        }
        .wrap400 {
          width: 400px !important;
          height: auto !important;
        }
        .block {
          display: block !important;
        }
        .center {
          text-align: center !important;
          margin: 0 auto !important;
        }
        .hero_txt01 {
          font-size: 36px !important;
          line-height: 41px !important;
        }
        .hero_txt02 {
          font-size: 14px !important;
          line-height: 24px !important;
          padding: 30px 0 34px !important;
        }
        .secondary_txt01 {
          font-size: 30px !important;
          line-height: 30px !important;
          padding: 28px 23px 8px 25px !important;
        }
        .secondary_txt02 {
          font-size: 14px !important;
          line-height: 19px !important;
          padding: 8px 23px 0px 25px !important;
        }
        .btn {
          width: 100% !important;
          font-size: 14px !important;
        }
        .w4background {
          background: url("images/hero_background01_MB.jpg");
          background-color: #0064b1;
          background-size: 400px !important;
          background-repeat: no-repeat;
          width: 400px !important;
          height: 443px !important;
        }
        .w4hero_txt01 {
          font-size: 36px !important;
          line-height: 46px !important;
        }
        .w4hero_txt02 {
          font-size: 20px !important;
          line-height: 26px !important;
        }
        .w4hero_txt03 {
          font-size: 14px !important;
          line-height: 24px !important;
          padding: 30px 0 34px !important;
        }
        .w4secondary_txt01 {
          font-size: 30px !important;
          line-height: 30px !important;
          padding: 28px 23px 8px 25px !important;
        }
        .w4secondary_txt02 {
          font-size: 14px !important;
          line-height: 19px !important;
          padding: 8px 23px 0px 25px !important;
        }
        u + .body .hero_txt01 {
          /* targets gmail app only */
          font-size: 32px !important;
          line-height: 39px !important;
        }
        .leftPAD {
          padding-left: 20px !important;
        }
        .em_hide {
          display: none !important;
        }
        .em_br {
          display: block !important;
        }
        .mob-head {
          font-size: 35px !important;
          line-height: 45px;
        }
        .entry {
          padding-right: 20px;
        }
        .videoPad {
          padding: 20px !important;
        }
        .videoTxt {
          padding: 0 20px 45px !important;
        }
        .wrap90 {
          width: 90% !important;
          height: auto !important;
        }
        .qHeight {
          height: 300px !important;
        }
        /* MOBILE GLOBAL STYLES - DO NOT CHANGE */
        body {
          padding: 0px !important;
          font-size: 16px !important;
          line-height: 150% !important;
        }
        h1 {
          font-size: 22px !important;
          line-height: normal !important;
        }
        h2 {
          font-size: 20px !important;
          line-height: normal !important;
        }
        h3 {
          font-size: 18px !important;
          line-height: normal !important;
        }
        .buttonstyles {
          font-family: arial, helvetica, sans-serif !important;
          font-size: 16px !important;
          color: #ffffff !important;
          padding: 10px !important;
        }
        /* END OF MOBILE GLOBAL STYLES - DO NOT CHANGE */
      }
      @media only screen and (max-width: 640px) {
        .container {
          width: 100% !important;
        }
        .mobile-hidden {
          display: none !important;
        }
        .logo {
          display: block !important;
          padding: 0 !important;
        }
        .photo img {
          width: 100% !important;
          height: auto !important;
        }
        .nav5,
        .nav6 {
          display: none !important;
        }
        .fluid,
        .fluid-centered {
          width: 100% !important;
          max-width: 100% !important;
          height: auto !important;
          margin-left: auto !important;
          margin-right: auto !important;
        }
        .fluid-centered {
          margin-left: auto !important;
          margin-right: auto !important;
        }
      }
      @media screen and (-webkit-min-device-pixel-ratio: 0) {
        span.entry {
          position: relative;
          padding-right: 20px !important;
          width: 100%;
          display: block;
        }
        span.entry:after {
          content: "+";
          font-size: 25px;
          color: #ffffff;
          position: absolute;
          right: 5px;
          top: 25px;
        }
        span.entry.open:after {
          content: "-";
          font-size: 28px;
          color: #ffffff;
          position: absolute;
          right: 7px;
          top: 20px;
        
    
}
      }
    </style>
    <!--[if mso]>
      <style type="text/css">
        /* Begin Outlook Font Fix */
        body,
        table,
        td {
          font-family: Arial, Helvetica, sans-serif;
        } /* End Outlook Font Fix */
      </style>
    <![endif]--><!--[if gte mso 9
      ]><xml>
        <o:OfficeDocumentSettings>
          <o:AllowPNG /> <o:PixelsPerInch>96</o:PixelsPerInch>
        </o:OfficeDocumentSettings>
      </xml><!
    [endif]-->
    </style>
  </head>
  <body
    data-gr-ext-installed=""
    data-new-gr-c-s-check-loaded="14.1020.0"
    data-new-gr-c-s-loaded="14.1020.0"
  >
    <meta charset="us-ascii" /><meta
      content="width=device-width, initial-scale=1"
      name="viewport"
    /><meta name="x-apple-disable-message-reformatting" /><meta
      http-equiv="X-UA-Compatible"
      content="IE=edge"
    /><meta content="telephone=no" name="format-detection" /><!--[if (mso 16)]>
      <style type="text/css">
        a {
          text-decoration: none;
        }
      </style> <!
    [endif]--><!--[if gte mso 9
      ]><style>
        sup {
          font-size: 100% !important;
        }
      </style><!
    [endif]--><!--[if gte mso 9]>
      <xml>
        <o:OfficeDocumentSettings>
          <o:AllowPNG></o:AllowPNG>
          <o:PixelsPerInch>96</o:PixelsPerInch>
        </o:OfficeDocumentSettings>
      </xml>
    <![endif]-->

我试图隐藏两侧的颜色。我的理解是,我必须创建块,以便电子邮件模板覆盖整个页面,而不仅仅是它的中间较小部分?我对html/css了解不多。

【问题讨论】:

  • 向我们展示一些代码示例
  • 添加了 CSS。谢谢
  • 哪位是“侧边栏”?也许使用标签的屏幕截图会有所帮助

标签: html css email html-email background-color


【解决方案1】:

bgcolor="#ffffff" 只需在表格标签中提供此代码并更改要制作背景的颜色代码 您要在其中更改背景颜色。您可以通过 gmail 联系 panchalbhargav1995 以获得有关电子邮件模板的更多帮助。

【讨论】:

  • 不是最好的解决方案,在您的 CSS 中您已经定义/设置了背景颜色。查看提供的代码,更改应该在 CSS 中而不是在桌面上。它只会使您的代码加倍。
猜你喜欢
  • 2023-01-12
  • 2020-01-10
  • 1970-01-01
  • 2011-04-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2022-12-20
  • 1970-01-01
相关资源
最近更新 更多