【问题标题】:How to center align the image in Google chrome which is already center aligned in mozilla firefox?如何在 Mozilla Firefox 中已居中对齐的 Google chrome 中的图像居中对齐?
【发布时间】:2014-03-10 10:38:39
【问题描述】:

单击超链接后,我正在显示图像。当我在 mozilla firefox 中显示图像时,它是居中对齐的,但是当我在 Google chrome 中显示相同的图像时,它是左对齐的。我不明白为什么会这样。为了您的参考,我在下面给出了 HTML 代码以及 mozilla firefox 和 Google chrome 中的屏幕截图。

HTML代码如下:

<a style="font-size:17px;" href="Annual Gathering 2014.jpg"><strong><font color="42515a">ANNUAL GATHERING 2014 ( Click to view the detail schedule)</font></strong></a>

Mozilla Firefox 中的屏幕截图如下:

谷歌浏览器的屏幕截图如下:

感谢您理解我的问题。等待您的回复。

【问题讨论】:

    标签: html css image google-chrome firefox


    【解决方案1】:

    这是显示图像的不同浏览器的个别默认行为,因为您直接链接到图像而不是将图像嵌入到 HTML 页面中。

    如果您决定将其嵌入 HTML 页面并链接到页面而不是图像,那么您可以控制图像的显示方式。

    【讨论】:

      【解决方案2】:

      使用它使图像在其父元素中居中

      img{
      display:block;
      margin:0 auto;
      }
      

      【讨论】:

        猜你喜欢
        • 2012-07-02
        • 1970-01-01
        • 1970-01-01
        • 2012-01-30
        • 2017-03-28
        • 2015-02-14
        • 2014-09-05
        • 2015-11-15
        相关资源
        最近更新 更多