我有这种形式,我在Chrome和FF中完美渲染,但在IE中,完全不对齐。
应该是什么样的:
图像:
HTML:
<!--image upload bit-->
<div class="portlet-content">
<div class="logoInfo">
<h3><strong>Large Logo</strong></h3>
<p>Width: 160px, Height: 20px | image will be resized automatically</p>
</div>
<div class="imageUploadLogo noLogo"><img id="agencyLogo" src="images/logo_silhouette.png" width="170px" height="32px"></div>
<a href="helper/uploadpic.php?lightbox[width]=360&lightbox[height]=140&lightbox[iframe]=1" class="lightbox"><div id="logo_uploada">Upload</div></a>
</div>
<div class="clearfix"></div>
<hr></hr>
<!--//image upload bit-->
<!--office upload bit-->
<div class="portlet-content">
<div class="logoInfo">
<h3><strong>Office Image</strong></h3>
<p>Width: 160px, Height: 120px | image will be resized automatically</p>
</div>
<div class="imageUploadPhoto noPhoto"><img id="agencyLogo" src="images/office_silhouette.png" width="160px" height="120px"></div>
<a href="helper/uploadpic.php?lightbox[width]=360&lightbox[height]=140&lightbox[iframe]=1" class="lightbox"><div id="logo_uploada">Upload</div></a>
<div class="extraInfo">
<h3><strong>Photo of your office</strong></h3>
<p>Image must be actual photograph of your office</p>
</div>
</div>
<div class="clearfix"></div>
<hr></hr>
<!--//office upload bit-->
<h3><strong>Office Description</strong> limited to 1000 characters ( no HTML tags )</h3>
<div class="field2"><label for="description">Office Description</label> <textarea class="resizable" id="officeDesc" rows="7" cols="50" name="description"></textarea>
</div>
<div class="clearfix"></div>
CSS:
/*agency profile stuff*/ .noLogo { border: 2px dashed #4f8a10; } .noPhoto { border: 2px dashed #4f8a10; } .imageUploadLogo { background-color: #fff; border: 2px dashed #CECECE; float: left; margin: 0 15px 0 0; padding: 20px 0; text-align: center; width: 190px; } .imageUploadPhoto { background-color: #fff; border: 2px dashed #CECECE; float: left; margin: 0 15px 0 0; padding: 20px 0; text-align: center; width: 190px; } #logo_uploada { position:absolute; left:300px; top:46px; width:180px; background: #999999; font-size: 26px; font-weight: bold; text-align: center; color: #FFF; padding-top: 10px;padding-bottom: 10px; -moz-border-radius: 5px; -webkit-border-radius: 5px; border-radius: 5px; margin-bottom: 0.4em; margin-top: 0.4em; } #logo_uploada a:visited, #logo_uploada a:link{ color: #fff; } #logo_uploada:hover { background-color: #3399ff; cursor:pointer; } .logoInfo { position:absolute; left:300px; top:5px; } .extraInfo { position:absolute; left:300px; top:110px; }
根据要求,这就是它在IE中的样子:
答案 0 :(得分:9)
好的回顾:
1)看起来你正在使用“hr”标签作为边框...当你不需要时。相反,将整个“portlet-content”和“imageUploadLogo”内容包装为一个类(即“uploadContainer”,其中包含“border-bottom:1px solid #CECECE; clear:both; display block; padding:0 0 20px 0 ; margin:0 0 20px 0; width:100%;)
.uploadContainer { border-bottom: 1px solid #CECECE; clear: both; display block; padding: 0 0 20px 0; margin: 0 0 20px 0; width: 100%; }
填充和边距用于间距。然后,您可以删除“hr”标记。
所以你的新容器将是:
<div class="uploadContainer">
<div class="portlet-content">
<div class="logoInfo">
<h3><strong>Office Image</strong></h3>
<p>Width: 160px, Height: 120px | image will be resized automatically</p>
</div>
<div class="imageUploadPhoto noPhoto"><img id="agencyLogo" src="images/office_silhouette.png" width="160px" height="120px"></div>
<a href="helper/uploadpic.php?lightbox[width]=360&lightbox[height]=140&lightbox[iframe]=1" class="lightbox"><div id="logo_uploada">Upload</div></a>
<div class="extraInfo">
<h3><strong>Photo of your office</strong></h3>
<p>Image must be actual photograph of your office</p>
</div>
</div>
2)#logo_uploada不需要“position:absolute”。而是设置“display:block;”然后保证金+填补头寸。
3)看起来你有两个容器的额外“/ div”标签......应该包装好,对吧?我发布的#1应该是 solid div容器供您使用。
如果您使用css-reset,则可能会重置所有div以使用“display:block”。
希望有所帮助!尝试这些风格并回顾它的运作方式。