介紹CSS外邊距是如何使用的

來源:互聯網
上載者:User
CSS Margin(外邊距)屬性定義元素周圍的空間。

Margin

margin清除周圍的元素(外邊框)的地區。margin沒有背景顏色,是完全透明的

margin可以單獨改變元素的上,下,左,右邊距。也可以一次改變所有的屬性。

Margin可以使用負值,重疊的內容。

<h2margin -="" 單邊外邊距屬性

在CSS中,它可以指定不同的側面不同的邊距:

執行個體

margin-top:100px;margin-bottom:100px;margin-right:50px;margin-left:50px;

Margin - 簡寫屬性

所有邊距屬性的縮寫屬性是"margin":

執行個體

margin:100px 50px;

margin屬性可以有一到四個值。/p>

margin:25px 50px 75px 100px;

上邊距為25px

右邊距為50px

下邊距為75px

左邊距為100px

margin:25px 50px 75px;

上邊距為25px

左右邊距為50px

下邊距為75px

margin:25px 50px;

上下邊距為25px

左右邊距為50px

margin:25px;

所有的4個邊距都是25px

【相關推薦】

1. 精選:“php程式員工具箱”V0.1版本下載

2. 免費css線上視頻教程

3. php.cn獨孤九賤(2)-css視頻教程

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.