padding?50%?,上下左右填充50%?
<!DOCTYPE?html?PUBLIC?"-//W3C//DTD?XHTML?1.0?Transitional//EN"?"
<html?xmlns="
<head>
<meta?http-equiv="Content-Type"?content="text/html;?charset=utf-8"?/>
<title>無標題文檔</title>
<style?type="text/css">
*?{?margin:0;?padding:0;?}
#div1,?#div2?{?width:100px;?height:100px;?margin:10px;?padding:50%;?border:1px?solid?#0CF;}
</style>
</head>
<body>
<div?id="div1"></div>
<div?id="div2"></div>
</body>
</html>
去掉padding:50%,瀏覽器顯示效果:
運行以上代碼測試看效果