<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>填充</title>
<style type="text/css">
#box1{
padding:10px 10px;
border:1px solid red;
}
</style>
</head>
<body>
<div id="box1">盒子1def</div>
</body>
</html>
块级元素宽度是100%,独占一行,这里没指定div的宽度。而且padding是指内边距。