我用了下面这种方法,很容易解决。
<
style
type
=
"text/css"
>
#leftbox{float:left;width:200px; background-color:#FF0000;}
#midbox{float:left;width:200px;background-color:#FFFF00}
.bottom{display:block;clear:both;margin-top:50px;background:#000000;width:300px;height:200px;color:#FFF;}
</
style
>
<
div
id
=
"leftbox"
>22</
div
>
<
div
id
=
"midbox"
>左边的内容左边的内容左边的内容左边的内容左边的内容左边的内容左边的内容</
div
>
<
script
>
if(midbox.offsetHeight>leftbox.offsetHeight)
leftbox.style.height=midbox.offsetHeight+"px";
else
midbox.style.height=leftbox.offsetHeight+"px";
</
script
>
<
div
class
=
"bottom"
>sssssssssssss</
div
>
下面论坛上别人的答案。
---------------------------
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
html
xmlns
=
"http://www.w3.org/1999/xhtml"
>
<
head
>
<
meta
http-equiv
=
"Content-Type"
content
=
"text/html; charset=utf-8"
/>
<
title
>无标题文档</
title
>
<
style
type
=
"text/css"
>
<!--
.main{
width:600px;
overflow:hidden;
}
.left{
background:#999999;
margin-bottom:-10000px;
padding-bottom:10000px;
width:200px;
float:left;
color:#FF0000;
}
.center{
background:#333333;
margin-bottom:-10000px;
padding-bottom:10000px;
width:200px;
float:left;
color:#FF0000;
}
.right{
background:#0000FF;
margin-bottom:-10000px;
padding-bottom:10000px;
width:200px;
float:left;
}
.bottom{
width:600px;
background:#CC00CC;
color:#000000;
height:100px;
}
-->
</
style
>
</
head
>
<
body
>
<
div
class
=
"main"
>
<
div
class
=
"left"
>left</
div
>
<
div
class
=
"center"
>center<
br
/>center<
br
/>center<
br
/>center<
br
/>center<
br
/>center<
br
/>center<
br
/></
div
>
<
div
class
=
"right"
>right</
div
>
</
div
>
<
div
class
=
"bottom"
>bottom</
div
>
</
body
>
</
html
>
|
---------------------------------------
---------------------------------------
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<
HTML
>
<
HEAD
>
<
TITLE
> New Document </
TITLE
>
<
META
NAME
=
"Generator"
CONTENT
=
"EditPlus"
>
<
META
NAME
=
"Author"
CONTENT
=
""
>
<
META
NAME
=
"Keywords"
CONTENT
=
""
>
<
META
NAME
=
"Description"
CONTENT
=
""
>
</
HEAD
>
<
style
>
.container{
display:table;
width:600px;
background:#ff6600;
margin:0px;
padding-top:0;
padding-right:0;
padding-bottom:0;
padding-left:0;
}
.leftbox{
width:300px;
background:#f00;
float:left;
height:100%;
}
.rightbox{
width:300px;
height:100%;
background:#c90;
float:right;
}
</
style
>
<
BODY
>
<
div
class
=
"container"
>
<
div
class
=
"leftbox"
>
就何必何必何必何必何必何必何必何必何必何必
</
div
>
<
div
class
=
"rightbox"
>
必何必何必何必何必何必何必何必何必何必何必何必何必必何必何必何必何必何必何必何必何必何必何必何必何必何必何必何必必何必何必何
</
div
>
</
BODY
>
</
HTML
>
|