1)css中的百分比,就目前所知,基本上都是根据父元素的大小来计算的。
<!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>
<title>边距使用百分比</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script src='./page.js' type='text/javascript'></script>
</head>
<body>
<div class='div-wrap'>
<div class='inner'>
<div class='innest'>
</div>
</div>
</div>
</body>
<style>
.inner{200px;height:200px;padding:10px;margin:10px auto;background: #f00;border: 1px solid #000;}
.innest{100%;height: 80%;background: #00f;margin: 10% auto;}
</style>
</html>