css那些事(一)

來源:互聯網
上載者:User

標籤:

一、內邊框padding和外邊框margin屬性縮寫

內外邊框有四個屬性:padding-top,padding-right,padding-bottom,padding-left;margin-top,margin-right,margin-bottom,margin-left。將其簡寫,就是把四個屬性合并成一個padding和margin即可。

內外邊框根據上右下左的順時針方向可以羅列以下4種簡寫方式

property:value1;表示所有邊都是一個值value1.

property:value1 value2;表示top,bottom是value1;right,left是value2.

property:value1 value2 value3;表示top是value1;right,left是value2;botom是value3;

property:value1 value2 value3 value4;表示top是value1;right是value2;left是value3;botom是value4;

二、選取器

1、包含選取器

p  strong{

}/*將p標籤裡的所有strong標籤定義樣式*/

2、子選取器

body > strong{

}/*body標籤下的子項目strong標籤*/

3、相鄰選取器

p + strong{

}/*與p標籤相鄰的strong的標籤*/

css那些事(一)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.