我故意搞错,导致div footer无法显示,我不明白为什么会有这种效果,请解答 nbsp;html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 第8课,实战首页布局 <br /> #container { <br /> width:1002px; <br /> background: gray; <br /> } <br /> <br /> #header { <br /> height: 120px; <br /> background: orange; <br /> } <br /> <br /> #main { <br /> height: 600px; <br /> background: green; <br /> } <br /> <br /> #lside { <br /> width: 700px; <br /> height: 600px; <br /> float: left; <br /> background: pink; <br /> } <br /> <br /> .four{ <br /> width: 330px; <br /> height: 280px; <br /> background: black; <br /> margin: 10px; <br /> float: left; <br /> } <br /> <br /> #rside { <br /> width: 302px; <br /> height: 600px; <br /> background: purple; <br /> float: right; <br /> } <br /> <br /> #footer { <br /> /*height: 120px;*/ <br /> height: 2020px; <br /> background: blue; <br /> float: left; <br /> } <br /> 回复讨论(解决方案) 什么效果,你指的是footer的背景没显示出来吗?原因是加float后宽度变为0