出處:http://goo.gl/QL51g

對我非常實用,我因為這個困擾超久的

如果有拉霸的話,在最最最外層再設定個

overflow:hidden; 就解決了

一瞬間變得好簡單 哇哈哈哈哈哈哈

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />

<title>CSS 100% Height</title>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>

<body>
<div id="content">
123
</div>
</body>
</html>
body {
	margin: 0;
	padding: 0;
}
#content {
	background: #EEE;
	border-left: 1px solid #000;
	border-right: 1px solid #000;
	padding: 0 20px 0 20px;
	margin: auto;
	font: 1.5em arial, verdana, sans-serif;
	width: 960px;
	height: 100%;
}
相關文章