<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <style> div{ height:300px; background-color: #cccccc; margin-top: 20px; margin-left: 20px; margin-right: 20px; margin-bottom: 20px; /*两端对齐*/ text-align: justify; /*上 右 下 左 margin: 30px 40px 50px 60px; 上右下左都一样 margin:20px; 上 左右 下 margin:20px 40px 50px; 上下 左右 margin:20px 40px*/ } *{ padding: 0px; margin: 0px; } p{ background-color: antiquewhite; height: 300px; } </style> <title>margin外边距</title> </head> <body> <div> 笑的大方,走的坦荡。笑的大方,走的坦荡。笑的大方,走的坦荡。笑的大方,走的坦荡。笑的大方,走的坦荡。 笑的大方,走的坦荡。笑的大方,走的坦荡。笑的大方,走的坦荡。笑的大方,走的坦荡。笑的大方,走的坦荡。 笑的大方,走的坦荡。 </div> <p>笑的大方,走的坦荡</p> </body> </html>