html - 我的内容在 IE 7 中左对齐?

标签 html css

我有一个外部 div,它在 chrome、firefox 中正常工作,但在 IE 中不能正常工作。我在外部 div 中有一些内容。为了使其居中对齐或页面中间,我给了这个宽度:970px;高度:630px;到外部 div... 这样我就可以在 chrome 和 Mozilla 中获得位于中心的内容... 但对于 IE 7.. 在 IE 中它左对齐..

这是我的CSS....

<style type="text/css">
body, html 
{ 
    font-family:helvetica,arial,sans-serif; 
    font-size:90%; 
}
div.outer 
{  
    display: block; 
    margin-left: auto;
    margin-right: auto;
    width:970px;
    height:630px;
    position:relative;
}
</style>

这是我的完整代码:

<head><title>home</title>
</head><body class='claro'><div class='outer' style="border:1px solid black;">
<div id="dottedBorderhome">
</div>
<div id="dragIconhome">
</div>
<div class="claro" id="menuDiv2" onclick="setWidgetproperty(this.id,'x','navMenu2');" onmousedown="setMenuBarProperty('navMenu2');" onmouseup="setDocStyle(this.id)" style="border: 1px dotted white; left: auto; position: absolute; top: 17px;">
     <!-- here one menu bar will come -->
</div>
<div class="claro" id="divlabel43" onclick="setWidgetproperty(this.id,null,'divlabel43')" onmouseup="setDocStyle(this.id)" style="left: 50px; position: absolute; top: 92px; text-align: right; font-family: Times; font-size: 15pt; font-weight: bold;" >
     <label id="label43" onclick="setLblProperty(this.id)" onmouseover="editName('divlabel43',this.id,'label')">
          Worklist Manager
     </label>
</div>
<div class="claro" id="htmlTableDiv9" onmouseup="setDocStyle(this.id)" style="left: auto; position: absolute; top: 130px; height:70px; width:150px;">
     <!-- here its contains table -->
</div>
<div class="claro" id="divImage2" onclick="setWidgetproperty(this.id,'xy','image2')" onmouseup="setDocStyle(this.id)" style="left: auto; position: absolute; top: 70px;">
     <img class="images" id="image2" name="Search-icon2.png" onclick="setImgProperty(this.id)" src="images/uploads/Search-icon2.png" style="height: 50px; width: 58px;">
</div>

<div class="claro" id="menuDiv1" onclick="setWidgetproperty(this.id,'x','navMenu1');" onmousedown="setMenuBarProperty('navMenu1');" onmouseup="setDocStyle(this.id)" style="border:1px dotted white; left: auto; position: absolute; top: 640px;">
     <!-- here another menu bar -->
</div>

<div id="CWPWORKLIST__1" onclick="setWidgetproperty(this.id,'xy','inner__CWPWORKLIST__1')" ondblclick="editDataGridResponseMapping(this.id)" onmouseup="setDocStyle(this.id)" style="left:auto; position:absolute; top:340px; height: 296px; width: 921px;">
     <!-- here another table-->
</div>
</div></body>

最佳答案

正如 Sven 所建议的,https://stackoverflow.com/questions/4742877/center-align-div-in-internet-explorer可能有你的答案。要么你有无效的 HTML 将 IE7 置于怪癖模式,要么你缺少文档类型。

关于html - 我的内容在 IE 7 中左对齐?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13986792/

相关文章:

javascript - 如果标量变量 > 0,Perl 更改图像/css

php - If else 嵌入到 html 中

jquery - 根据数量设置具有相同类的多个元素的宽度

html - WordPress CSS 背景图像未出现

html - 按钮未在 Chrome 中定位

html - 在 erb 文件中设置虚线内联样式

javascript - super 菜单的第三级不起作用

html - 为什么内容没有被重叠元素的背景覆盖?

html - 表格的底部边框不显示

html - 将 2 个输入文本框并排放置