在php电子邮件中以图片为中心的问题

时间:2016-04-03 08:15:31

标签: php html css css3 email

我试图通过使用内联样式将图标图像集中在php电子邮件中,无论我做什么,我都无法让它们在closing-email-section-container水平居中。

我尝试将text-center和margin:0 auto;`添加到每个图标的范围内,并将父项添加到它们。都没有奏效。填充也是如此,没有什么可以。

我做错了什么?



    <div id="closing-email-section" style="margin-top: 150px;">
      <div id="closing-email-section-container" style="background:#f6f6f6; width: 100%; height: 150px;">
        <div id="newsletter-social-media" style="text-align:center; margin-top:10px; font-size: .9em;margin-bottom:15px;">Follow us on Social Media</div>
        <div id="newsletter-social-media-icons" style="text-align:center;margin: 15px auto;display:inline-block;">
    			<span style=" "><a href="http://facebook.com/optimumwebdesigns/ " target="_blank "><img src="http://optimumwebdesigns.com/icons/facebookBlack.png " alt="Facebook " width="45px " height="45px "></a></span>
    			<span style=" "><a href="https://twitter.com/OptWebDesigns " target="_blank "><img src="http://optimumwebdesigns.com/icons/twitterBlack.png " alt="Twitter " width="45px " height="45px "></a></span>
    			<span style=" "><a href="http://linkedin.com " target="_blank "><img src="http://optimumwebdesigns.com/icons/linkedInBlack.png " alt="LinkedIn " width="45px " height="45px "></div></a></span>
    		</div>
    	</div>
    </div>
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:1)

我认为它应该使用style:block而不是inline block

如下代码:

  <div id="closing-email-section" style="margin-top: 150px;">
      <div id="closing-email-section-container" style="background:#f6f6f6; width: 100%; height: 150px;">
        <div id="newsletter-social-media" style="text-align:center; margin-top:10px; font-size: .9em;margin-bottom:15px;">Follow us on Social Media</div>
        <div id="newsletter-social-media-icons" style="text-align:center;margin: 15px auto;display:block;>
    			<span style=" "><a href="http://facebook.com/optimumwebdesigns/ " target="_blank "><img src="http://optimumwebdesigns.com/icons/facebookBlack.png " alt="Facebook " width="45px " height="45px "></a></span>
    			<span style=" "><a href="https://twitter.com/OptWebDesigns " target="_blank "><img src="http://optimumwebdesigns.com/icons/twitterBlack.png " alt="Twitter " width="45px " height="45px "></a></span>
    			<span style=" "><a href="http://linkedin.com " target="_blank "><img src="http://optimumwebdesigns.com/icons/linkedInBlack.png " alt="LinkedIn " width="45px " height="45px "></div></a></span>
    		</div>
    	</div>
    </div>