gpt4 book ai didi

html - 在 Internet Explorer 5 上将 DIV 彼此对齐

转载 作者:行者123 更新时间:2023-11-28 06:26:55 25 4
gpt4 key购买 nike

我需要将两个 div 对齐。我通过使用以下代码实现了它:

Fiddle.js

CSS:

.wrapper {
display: table;
width: 100%;
border:5px solid blue;
}

.left {
display: inline-block;
width:10%;
height:160px;
display: table-cell;
border:5px solid red;
}

.right {
vertical-align:top;
display: inline-block;
height:160px;
display: table-cell;
border:5px solid grey;
}

HTML:

<div class="wrapper">
<div class="left">DIV #1</div>
<div class="right">DIV #2</div>
</div>

这适用于所有浏览器,除了我们在 IE5 模式下运行的 IE,因为我们使用了一些 Web-Dynpros,不幸的是,它需要这个引擎才能正确呈现。然而,Internet Explorer 并没有像我希望的那样显示 div。在 IE 中它看起来像下图:

Image

最佳答案

你可以试试这个:

.wrapper {
display: table;
width: 100%;
border:5px solid blue;
height:300px;
}
.box
{
border:5px solid green;
height:auto;
float:left;
width: 80%;
height:250px;
}
.left {
display: inline-block;
width:20%;
height:100px;
display: table-cell;
border:5px solid red;
float:left;
}
.right {
vertical-align:top;
display: inline-block;
height:100px;
display: table-cell;
border:5px solid grey;
float:right;
margin-top:110px;
position:absolute;
margin-left:100px;
width:300px;
}

DEMO HERE

关于html - 在 Internet Explorer 5 上将 DIV 彼此对齐,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35219850/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com