dongpu1879 2016-04-03 08:15
浏览 65
已采纳

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

I am trying to center icon images within a php email by using inline styling and no matter what I do I cannot get them to center within the closing-email-section-container horizontally.

I have tried adding text-center and margin: 0 auto;` to the span of each icon and the parent to them. Neither worked. The same is with the padding, nothing will take.

What am I doing wrong?

    <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>

</div>
  • 写回答

1条回答 默认 最新

  • douqiang1910 2016-04-03 08:27
    关注

    I think it should use style: block instead of inline block

    As the following code :

      <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>

    </div>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 Todesk 远程写代码 anaconda jupyter python3
  • ¥15 我的R语言提示去除连锁不平衡时clump_data报错,图片以下所示,卡了好几天了,苦恼不知道如何解决,有人帮我看看怎么解决吗?
  • ¥15 在获取boss直聘的聊天的时候只能获取到前40条聊天数据
  • ¥20 关于URL获取的参数,无法执行二选一查询
  • ¥15 液位控制,当液位超过高限时常开触点59闭合,直到液位低于低限时,断开
  • ¥15 marlin编译错误,如何解决?
  • ¥15 有偿四位数,节约算法和扫描算法
  • ¥15 VUE项目怎么运行,系统打不开
  • ¥50 pointpillars等目标检测算法怎么融合注意力机制
  • ¥20 Vs code Mac系统 PHP Debug调试环境配置