使用CSS设置元素的上边距

 边距指定元素的上边距。它的长度值可以是%或auto。您可以尝试运行以下代码来设置上边距:

示例

<html>
   <head>
   </head>
   <body>
      <p style = "margin-top: 10px; border:2px solid red;">
         This is a paragraph with a specified top margin
      </p>
      <p style = "margin-top: 10%; border:2px solid green;">
         This is another paragraph with a specified top margin in percent
      </p>
   </body>
</html>