IE中重叠元素的垂直对齐 [英] Vertical alignment of elements overlapping in IE

查看:55
本文介绍了IE中重叠元素的垂直对齐的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要构建的表单可以完美地在Chrome和FF中呈现,但是在IE中完全不对齐.

I have this form I am building that renders perfectly in Chrome and FF, but in IE, is completely mis-aligned.

它应该是什么样的

图片:

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中的外观:

As requested, this is what it looks like in IE:

推荐答案

好的评论:

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%;)

1) it looks like you're using "hr" tags for the border...when you don't need to. Instead, wrap your entire "portlet-content" and the "imageUploadLogo" content with a class (i.e. "uploadContainer" that has a "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"标签.

The padding and margin are for spacing. You can then remove the "hr" tags.

因此您的新容器将是:

<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具有位置:绝对".而是设置为"display:block;".然后边距+填充位置.

2) There's no need for #logo_uploada to have a "position: absolute". Instead, set "display: block;" and then margin + padding for position.

3)好像您在这两个容器中有一个额外的"/div"标签……应该包裹在里面,对吗?我发布的#1应该是 solid div容器供您使用.

3) It looks like you have an extra "/div"-tag for those two containers... should be wrapped in something, right? #1 that I posted should be a solid div container for you to use.

如果您使用的是 css重置.

希望有帮助!尝试这些样式并回溯其运行方式.

Hope that helps! Try those styles and ping back how it goes.

这篇关于IE中重叠元素的垂直对齐的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆