Computer >> คอมพิวเตอร์ >  >> การเขียนโปรแกรม >> CSS

การใช้คุณสมบัติมาร์จิ้นด้วย CSS


ระยะขอบ คุณสมบัติกำหนดพื้นที่รอบองค์ประกอบ HTML คุณสามารถใช้ค่าลบเพื่อทับซ้อนเนื้อหาได้ ระบุคุณสมบัติชวเลขสำหรับการตั้งค่าคุณสมบัติระยะขอบในหนึ่งประกาศ

ตัวอย่าง

คุณสามารถลองใช้โค้ดต่อไปนี้เพื่อตั้งค่าระยะขอบได้ -

<html>
   <head>
   </head>
   <body>
      <p style = "margin: 20px; border:2px solid yellow;">
         All four margins will be 20px
      </p>
      <p style = "margin: 15px 4% -10px; border:2px solid red;">
         Top margin will be 15px, left and right margin will be 4% of the total width of the document, bottom margin will be -10px
      </p>
   </body>
</html>