posts - 20,  comments - 2,  trackbacks - 0

作者: tianshi0253  链接:http://tianshi0253.javaeye.com/blog/205278  发表时间: 2008年06月18日

声明:本文系JavaEye网站发布的原创博客文章,未经作者书面许可,严禁任何网站转载本文,否则必将追究法律责任!

<!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>

 要设置网页的,html,body,和它的父元素的高度为100%才可以。


本文的讨论也很精彩,浏览讨论>>


JavaEye推荐




文章来源:http://tianshi0253.javaeye.com/blog/205278
posted on 2008-06-18 18:10 姚文超 阅读(372) 评论(0)  编辑  收藏

只有注册用户登录后才能发表评论。


网站导航: