css 條紋背景

來源:互聯網
上載者:User

標籤:span   16px   痛點   table   back   寬度   屬性   blog      

先介紹文章用到的二個知識點

 background-size 屬性

文法

background-size: length|percentage|cover|contain;
length

設定背景映像的高度和寬度。

第一個值設定寬度,第二個值設定高度。

如果只設定一個值,則第二個值會被設定為 "auto"。

 

 

 

percentage

以父元素的百分比來設定背景映像的寬度和高度。

第一個值設定寬度,第二個值設定高度。

如果只設定一個值,則第二個值會被設定為 "auto"。

 

 

 

cover

把背景映像擴充至足夠大,以使背景映像完全覆蓋背景地區。

背景映像的某些部分也許無法顯示在背景定位地區中。

 

 

 

contain 把映像映像擴充至最大尺寸,以使其寬度和高度完全適應內容地區。

 

 

 

css線性漸層linear-gradient(to  <side-or-corner>)||<angle>,<color-stop>,<color-stop>)

 

<side-or-corner> = [left | right] || [top | bottom]

用角度值指定漸層的方向(或角度)。

<color-stop> = <color> [ <length> | <percentage> ]

background: linear-gradient(to top,red ,blue );

我們再改下代碼:

background: linear-gradient(to top,red 50% ,blue 50%);
background-:

變為:

再改寫:

background: linear-gradient(to top,red 50% ,blue 50%);             background-size:100% 30px ;
水平條紋出現

將顏色後面的百分比即色標所在的位置重合,形成了水平條紋效果。

 

 

假如寫超過二種顏色也是可以的:

background: linear-gradient(to top,red 33.3% ,blue 0%,blue 66.7%,pink 0);            background-size:100% 90px ;

垂直條紋

原來同水平條紋,只需改下background-size和linear=gradient漸層方向

background: linear-gradient(to right,red 33.3% ,blue 0%,blue 66.7%,pink 0);       background-size:90px 100% ;

痛點:斜向條紋

 

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.