如何将图像居中对齐在已经在mozilla firefox中心对齐的Google Chrome中?

时间:2014-02-12 08:18:54

标签: html css image google-chrome firefox

单击超链接后我显示图像。当我在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中的屏幕截图如下: enter image description here

Google Chrome中的屏幕截图如下: enter image description here

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

2 个答案:

答案 0 :(得分:3)

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

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

答案 1 :(得分:1)

使用它将图像置于其父元素中心

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