gpt4 book ai didi

css - 并排 float 两个div

转载 作者:行者123 更新时间:2023-12-02 05:09:40 34 4
gpt4 key购买 nike

无论屏幕大小如何,我都试图并排 float 两个 div。目前在 IE 7 中,如果我调整窗口大小,一个 div 会下降到另一个下方。我认为这是因为 div2 包含一个表格,一旦窗口边缘碰到表格,它就会下降到 div1 下面。

我目前在 IE9 和 Firefox 中工作,但它需要在 IE6+7 中工作。我试过这个解决方案 CSS floats - how do I keep them on one line?但它似乎没有帮助。我再次认为这可能是由于这些 div 中的内容所致。如何复制?

代码:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta charset=utf-8 />
<title>JS Bin</title>

<style>
#wrapper {
min-width:510px;
width: auto !important;
width: 510px;
border: 1px solid red; }

#div1 {
float:left;
color:blue;
width:500px;
border: 1px dashed purple;
height: 400px;}

#div2 {
margin-left:505px;
border:1px dashed purple;}

#div2 table{border: 1px dotted green;}

</style>
</head>
<body>
<div id="wrapper">
<div id="div1" >
Sometimes I contain a table and sometimes I contain an object. Bother of which displays a chart
</div>
<div id="div2">
<table>
<tr>
<td> I am normally a report
asdfasdfads
dsafasdfasdfasdfasdfadsfasdfasdadfadsfadfsdfasdfsdffGreat Thanks, today has been quiet hot but somehow a bit cooler than this time last year.
</td>
<td></td>
</tr>
</table>
</div>
</div>
</body>
</html>

可以在这里找到一个实例 http://jsbin.com/awijew/11

最佳答案

去掉margin-left: 505px;在 div2 上

关于css - 并排 float 两个div,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6937887/

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