作者: tianshi0253 鏈接:http://tianshi0253.javaeye.com/blog/205278 發(fā)表時間: 2008年06月18日
聲明:本文系JavaEye網(wǎng)站發(fā)布的原創(chuàng)博客文章,未經(jīng)作者書面許可,嚴禁任何網(wǎng)站轉(zhuǎn)載本文,否則必將追究法律責任!
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>height auto</title> <style type="text/css"> html,body{text-align:center; margin:0px; padding:0px; height:100%;} #box { overflow:auto; border:solid 1px red; float:left; margin-left:auto; margin-right:auto; width:80%; } .subbox{ display:inline; display:block; float:left; width:100px; margin:50px; border:solid 1px red; height:50%; } #box{height:100%;} </style> </head> <body> <div id="box"> <div class="subbox"></div> </div> </body> </html>
要設(shè)置網(wǎng)頁的,html,body,和它的父元素的高度為100%才可以。
本文的討論也很精彩,瀏覽討論>>
JavaEye推薦
- 北京: 千橡集團暨校內(nèi)網(wǎng)誠聘軟件研發(fā)工程師
- 搜狐網(wǎng)站誠聘Java、PHP和C++工程師
- Oracle專區(qū)上線,有Oracle最新文章,重要下載及知識庫等精彩內(nèi)容,歡迎訪問。
- 立刻報名,免費獲取門票,參加SOA技術(shù)論壇(廣州6月19日)
文章來源:http://tianshi0253.javaeye.com/blog/205278