html - Internet Explorer 和 Google Chrome 的内容显示方式不同

标签 html css image internet-explorer layout

我正在设置一个在线表格,用于选择盒子和东西。 当我对自己说“让我们在 IE 中试试吧”时,我几乎完成了整个事情。

这是我想要的结果以及 Google Chrome 中出现的结果:

Google Chrome result

这就是 IE 中发生的事情:

enter image description here

这是该部分的 CSS 和 HTML:

HTML

<div id="choosen"><img src="img.jpg" class="center-img" /></div>

CSS

 img.center-img{
        margin-top:15px;
        position:relative;
        width: <?php echo $width; ?>px;
        left:50%;
        margin-left:-<?php echo $width/2; ?>px;
    }

基本上图像位于 div 的中心,因为我正在写的这个页面将被包含到另一个我从未见过的页面中,其他人会这样做。

已编辑

Here is the link

最佳答案

如何将 CSS 更改为

img.center-img{
    margin:15px auto 0;
    display:block;
}

关于html - Internet Explorer 和 Google Chrome 的内容显示方式不同,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17379100/

相关文章:

html - 溢出换行 : break-word vs. 断字:断字

html - 同时使用垂直对齐和高度

javascript - 如何使样式元素的一部分成为函数? (IE : color:$random instead of color:red)

javascript - 如何在javascript中获取当前点击的图片的数量

html - 如何阻止 <nav> 在中间 split

javascript - 在我的应用程序中为 HTML/CSS 编辑哪些文件 (ruby)

html - 如何避免 <thead> 和 <tbody> 之间的分页符

html - 溢出 :hidden ignoring bottom padding

image - 从一组图片中检测(并去除)划痕

html - 如何在 CSS 中在另一个背景图像下显示背景图像