2013-01-28 2 views
-1

나는 최근에 2 개의 회보를 디자인하고 완성했다; 하지만 빠르게 변경 (컨테이너 바깥쪽에 배경색을 추가) 할 때 내용과 배경색 사이에 수수께끼가 있음을 깨달았습니다. 배경을 얻으려는 것입니다. 주 내용의 가장자리에 맞춰 색을 바꿔라.Mystery Padding ..?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html> 
    <head> 
     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 

     <title>The Cook's Nook</title> 
     <style type="text/css"> 
      /* Client-specific Styles */ 
      #outlook a{padding:0;} /* Force Outlook to provide a "view in browser" button. */ 
      body{width:100% !important;} .ReadMsgBody{width:100%;} .ExternalClass{width:100%;} /* Force Hotmail to display emails at full width */ 
      body{-webkit-text-size-adjust:none;} /* Prevent Webkit platforms from changing default text sizes. */ 

      /* Reset Styles */ 
      body{margin:0; padding:0;} 
      img{border:0; height:auto; line-height:100%; outline:none; text-decoration:none;} 
      table td{border-collapse:collapse;} 
      #backgroundTable{height:100% !important; margin:0; padding:0; width:100% !important;} 

      /* Template Styles */ 

      /* /\/\/\/\/\/\/\/\/\/\ STANDARD STYLING: COMMON PAGE ELEMENTS /\/\/\/\/\/\/\/\/\/\ */ 

      /** 
      * @tab Page 
      * @section background color 
      * @tip Set the background color for your email. You may want to choose one that matches your company's branding. 
      * @theme page 
      */ 
      body, #backgroundTable{ 
       background-color:#7C1A27; 
      } 

      /** 
      * @tab Page 
      * @section email border 
      * @tip Set the border for your email. 
      */ 
      #templateContainer{ 
      } 

      /** 
      * @tab Page 
      * @section heading 1 
      * @tip Set the styling for all first-level headings in your emails. These should be the largest of your headings. 
      * @style heading 1 
      */ 
      h1, .h1{ 
       color:#000000; 
       display:block; 
       font-family:Arial; 
       font-size:12px; 
       line-height:100%; 
       margin-top:0; 
       margin-right:0; 
       margin-left:0; 
       text-align:left; 
       font-weight: normal; 
      } 

      /** 
      * @tab Page 
      * @section heading 2 
      * @tip Set the styling for all second-level headings in your emails. 
      * @style heading 2 
      */ 
      h2, .h2{ 
       color:#202020; 
       display:block; 
       font-family:Arial; 
       font-size:30px; 
       font-weight:bold; 
       line-height:100%; 
       margin-top:0; 
       margin-right:0; 
       margin-bottom:10px; 
       margin-left:0; 
       text-align:left; 
      } 

      /** 
      * @tab Page 
      * @section heading 3 
      * @tip Set the styling for all third-level headings in your emails. 
      * @style heading 3 
      */ 
      h3, .h3{ 
       color:#202020; 
       display:block; 
       font-family:Arial; 
       font-size:26px; 
       font-weight:bold; 
       line-height:100%; 
       margin-top:0; 
       margin-right:0; 
       margin-bottom:10px; 
       margin-left:0; 
       text-align:left; 
      } 

      /** 
      * @tab Page 
      * @section heading 4 
      * @tip Set the styling for all fourth-level headings in your emails. These should be the smallest of your headings. 
      * @style heading 4 
      */ 
      h4, .h4{ 
       color:#202020; 
       display:block; 
       font-family:Arial; 
       font-size:16px; 
       font-weight:normal; 
       line-height:100%; 
       margin-top:0; 
       margin-right:0; 
       margin-bottom:10px; 
       margin-left:0; 
       text-align:left; 
      } 

      /* /\/\/\/\/\/\/\/\/\/\ STANDARD STYLING: HEADER /\/\/\/\/\/\/\/\/\/\ */ 

      /** 
      * @tab Header 
      * @section header style 
      * @tip Set the background color and border for your email's header area. 
      * @theme header 
      */ 
      #templateHeader{ 
       background-color:#FFFFFF; 
       border-bottom:0; 
      } 

      /** 
      * @tab Header 
      * @section header text 
      * @tip Set the styling for your email's header text. Choose a size and color that is easy to read. 
      */ 
      .headerContent{ 
       color:#202020; 
       font-family:Arial; 
       font-size:34px; 
       font-weight:bold; 
       line-height:100%; 
       padding:0; 
       text-align:center; 
       vertical-align:middle; 
      } 

      /** 
      * @tab Header 
      * @section header link 
      * @tip Set the styling for your email's header links. Choose a color that helps them stand out from your text. 
      */ 
      .headerContent a:link, .headerContent a:visited, /* Yahoo! Mail Override */ .headerContent a .yshortcuts /* Yahoo! Mail Override */{ 
       color:#336699; 
       font-weight:normal; 
       text-decoration:underline; 
      } 

      #headerImage{ 
       height:auto; 
       max-width:600px !important; 
      } 

      /* /\/\/\/\/\/\/\/\/\/\ STANDARD STYLING: MAIN BODY /\/\/\/\/\/\/\/\/\/\ */ 

      /** 
      * @tab Body 
      * @section body style 
      * @tip Set the background color for your email's body area. 
      */ 
      #templateContainer, .bodyContent{ 
       background-color:#FFFFFF; 
      } 

      /** 
      * @tab Body 
      * @section body text 
      * @tip Set the styling for your email's main content text. Choose a size and color that is easy to read. 
      * @theme main 
      */ 
      .bodyContent div{ 
       color:#505050; 
       font-family:Arial; 
       font-size:13px; 
       line-height:120%; 
       text-align:left; 
       margin-left: 10px 
      } 

      /** 
      * @tab Body 
      * @section body link 
      * @tip Set the styling for your email's main content links. Choose a color that helps them stand out from your text. 
      */ 
      .bodyContent div a:link, .bodyContent div a:visited, /* Yahoo! Mail Override */ .bodyContent div a .yshortcuts /* Yahoo! Mail Override */{ 
       color:#336699; 
       font-weight:normal; 
       text-decoration:underline; 
      } 

      .bodyContent img{ 
       display:inline; 
       height:auto; 
      } 

      /* /\/\/\/\/\/\/\/\/\/\ STANDARD STYLING: FOOTER /\/\/\/\/\/\/\/\/\/\ */ 

      /** 
      * @tab Footer 
      * @section footer style 
      * @tip Set the background color and top border for your email's footer area. 
      * @theme footer 
      */ 
      #templateFooter{ 
       background-color:#FFFFFF; 
       border-top:0; 
      } 

      /** 
      * @tab Footer 
      * @section footer text 
      * @tip Set the styling for your email's footer text. Choose a size and color that is easy to read. 
      * @theme footer 
      */ 
      .footerContent div{ 
       color:#707070; 
       font-family:Arial; 
       font-size:12px; 
       line-height:125%; 
       text-align:left; 
      } 

      /** 
      * @tab Footer 
      * @section footer link 
      * @tip Set the styling for your email's footer links. Choose a color that helps them stand out from your text. 
      */ 
      .footerContent div a:link, .footerContent div a:visited, /* Yahoo! Mail Override */ .footerContent div a .yshortcuts /* Yahoo! Mail Override */{ 
       color:#336699; 
       font-weight:normal; 
       text-decoration:underline; 
      } 

      .footerContent img{ 
       display:inline; 
      } 

      /** 
      * @tab Footer 
      * @section social bar style 
      * @tip Set the background color and border for your email's footer social bar. 
      * @theme footer 
      */ 
      #social{ 
       background-color:#FAFAFA; 
       border:0; 
      } 

      /** 
      * @tab Footer 
      * @section social bar style 
      * @tip Set the background color and border for your email's footer social bar. 
      */ 
      #social div{ 
       text-align:center; 
      } 

      /** 
      * @tab Footer 
      * @section utility bar style 
      * @tip Set the background color and border for your email's footer utility bar. 
      * @theme footer 
      */ 
      #utility{ 
       background-color:#FFFFFF; 
       border:0; 
      } 

      /** 
      * @tab Footer 
      * @section utility bar style 
      * @tip Set the background color and border for your email's footer utility bar. 
      */ 
      #utility div{ 
       text-align:center; 
      } 

      #monkeyRewards img{ 
       max-width:190px; 
      } 
     </style> 
    </head> 
    <body leftmargin="0" marginwidth="0" topmargin="0" marginheight="0" offset="0"> 
     <center> 
      <table border="0" cellpadding="0" cellspacing="0" height="100%" width="100%" id="backgroundTable"> 
       <tr> 
        <td align="center" valign="top"> 
         <table border="0" cellpadding="0" cellspacing="0" width="600" id="templateContainer"> 
          <tr> 
           <td align="center" valign="top"> 
            <!-- // Begin Template Header \\ --> 
            <table border="0" cellpadding="0" cellspacing="0" width="600" id="templateHeader"> 
             <tr> 
              <td class="headerContent"> 

               <!-- // Begin Module: Standard Header Image \\ --> 
               <img src="images/header-bg.png" /> 
               <a href="#"><img src="images/social-events.png" style="float:right;padding-right:25px;" /></a> 
               <a href="https://www.facebook.com/TheCooksNook?fref=ts"><img src="images/social-fb.png" style="float:right;padding-right:3px;" /></a> 
               <!-- // End Module: Standard Header Image \\ --> 
              <a href="#"><img src="images/logo.png" style="float:left;padding-top:20px;padding-left:30px;" /></a> 
              <br /><br /><div style="float:right;"> 
                <h1 style="padding-right:25px;text-align:right;margin-top:30px;"><strong>Holiday Hours:</strong>&nbsp;Monday-Friday&nbsp;9am-8pm</h1> 
                <h1 style="padding-right:25px;text-align:right;">Saturday&nbsp;9am-5pm&nbsp;&bull;&nbsp;Sunday&nbsp;1pm-5pm</h1> 
               </div> 

              </td>                      
             </tr>          
            </table> 
            <!-- // End Template Header \\ --> 
           </td> 
          </tr> 
          <tr> 
           <td align="center" valign="top"> 
            <!-- // Begin Template Body \\ --> 
            <table border="0" cellpadding="0" cellspacing="0" width="600" id="templateBody"> 
             <tr> 
               <a href="#"><img src="images/butn-home.png" style="padding-top:15px;" /></a> 
               <a href="#"><img src="images/butn-about-us.png" /></a> 
               <a href="#"><img src="images/butn-in-store-coupons.png" /></a> 
               <a href="#"><img src="images/butn-photo-gallery.png" /></a> 
               <a href="#"><img src="images/butn-recipe-blog.png" /></a> 
               <a href="#"><img src="images/butn-contact-us.png" /></a> 
              <td valign="top" class="bodyContent">                     
               <!-- // Begin Module: Standard Content \\ --> 
               <table border="0" cellpadding="20" cellspacing="0" width="100%"> 
                <tr> 
                 <td valign="top" style="padding-bottom:0px;"> 
                  <div> 
                   A few years back (1998), one of our employees baked and brought this coffee cake recipe to all of us at the store.  We have had numerous calls over the years from people who misplaced this recipe and wanted to see if they could still get it from us. 
                   <br /><br /> 
                   <h4>Cindy's Coffee Cake</h4> 
                   <img src="images/featured-image.png" style="float:left;margin-top:5px;"/>                   
                   <span style="line-height:110%;">  
                      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&bull; 1 yellow cake mix<br /> 
                      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&bull; 1 cup sour cream<br /> 
                      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&bull; 3 eggs<br /> 
                      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&bull; 1 cup pecans<br /> 
                      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&bull; ¼ cup water<br /> 
                      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&bull; ¾ cup brown sugar<br /> 
                      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&bull; 1 teaspoon cinnamon<br /> 
                      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&bull; ¾ cup melted margarine<br /> 
                      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&bull; 1 ¼ cups graham cracker crumbs<br /><br /> 
                   </span>                    


                   Grease and flour a 10-inch round cake pan.  In a large bowl, combine cracker crumbs, nuts, brown sugar, cinnamon and margarine.  Set aside.  In another bowl, pour cake mix, sour cream, water and eggs.  Mix at low speed until moist, then beat at high speed for two minutes.  Pour half the batter into pan.  Sprinkle half crumb mix on top, then repeat with batter and crumb mix.  Bake at 350 degrees for 30 – 40 minutes until done.  Cool upright for 10 – 15 minutes.  Invert on plate.  Cool.  Glaze with powdered sugar and milk.               </div> 
                   <div style="margin-top:25px;"><center> 
                   <img src="images/coupon-1.png" style="" /> 
                   <img src="images/coupon-2.png" style="padding-left:15px;"/></center> 
                   </div>            
                   <div style="float:right;padding-right:30px;padding-top:20px;"> 
                    <a href="#"><img src="images/butn-view-print-coupons.png" /></a> 
                   </div>     
                 </td> 
                </tr> 
               </table> 
               <!-- // End Module: Standard Content \\ --> 

              </td> 
             </tr> 
            </table> 
            <!-- // End Template Body \\ --> 
           </td> 
          </tr> 
          <tr> 
           <td align="center" valign="top"> 
            <!-- // Begin Template Footer \\ --> 
            <table border="0" cellpadding="10" cellspacing="0" width="600" id="templateFooter"> 
             <tr> 
              <td valign="top" class="footerContent">            
               <!-- // Begin Module: Standard Footer \\ --> 
               <table border="0" cellpadding="10" cellspacing="0" width="100%"> 
                <tr> 
                 <td colspan="2" valign="middle" id="utility" style="padding-top:2px;"> 
                  <div> 
                   <img src="images/footer-bg.png" /> 
                  </div> 
                 </td> 
                </tr>              
               </table> 
               <!-- // End Module: Standard Footer \\ -->            
              </td> 
             </tr> 
            </table> 
            <!-- // End Template Footer \\ --> 
           </td> 
          </tr> 
         </table> 
         <br /> 
        </td> 
       </tr> 
      </table> 
     </center> 
    </body> 
</html> 
+0

어떤 메일 클라이언트에서이 미스테리 패딩이 보입니까? – BoltClock

+0

및 어떤 웹 브라우저 – LegendaryLaggy

+0

컨테이너 왼쪽의 10px 여백을 의미합니까 (.bodyContent div)? 편집 :이 경우, 당신이 찾고있는 것을 설명하는 screengrab이 정말로 도움이 될 것이라고 생각합니다. – isotrope

답변

0

: 나는 여기

Fiddle

뉴스 레터의 전체 소스입니다 .. CSS를 꽤 주위에 해본 적이 있지만, 여전히 수정을 마련하지 않은 나를 위해 테이블과 나쁜 행동을 피하기 위해 가장 좋은 방법은 "테이블 레이아웃 : 고정;"설정하는 것입니다 테이블을 사용하여 컬럼의 너비를 요소로 설정하십시오.

플러스, 나는 당신이 당신의 스타일 태그를 인라인 CSS로 변환하기 위해 어떤 종류의 도구를 사용하고 있다고 가정합니다. 나는 그것에 대해 조언한다. 이것은 전자 메일에 무게를 더하는 불필요한 많은 코드를 생성 할 것이다.

+0

저는 코드를 재구성하려는 의미였습니다. 마지막 순간에 조정을하고 있기 때문에 정리가 안되기 때문에 더 지저분합니다. 확실히 코드를 정리하고 제안을 시도 할 것입니다. 그리고 명확히하기 위해 screengrab를 게시 할 것이고, @isotrope에 대해 생각해 봐야 할 것이 있습니다. –