padding内边距
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> <style> .box{ /*设置上 右 下 左的内边距*/ padding: 20px 5px 10px 5px; border: 1px solid red; 100px; height: 100px; /*内边距享有背景色*/ background-color: yellow; } </style> </head> <body> <div class="box"></div> </body> </html>
效果如下: