Mirror app HTML樣式CSS之DIV遮罩背景層樣式

來源:互聯網
上載者:User

標籤:style   blog   http   color   os   2014   

設定背景圖片後,如果背景圖片顏色太亮,則建議放個div遮罩背景層~目前Google 放出的css中div遮罩層的樣式:

 1 /* Overlay gradient to allow text to be read over the image. */ 2  3 /* For cards with two lines of text (excluding footer) 4  * ex: hybrid templates & those needing more bottom readability 5  */ 6 div.overlay-gradient-tall { 7   display: block; 8   position: absolute; 9   top: 30%;10   left: 0;11   right: 0;12   bottom: 0;13   background: -webkit-linear-gradient(rgba(0,0,0,0.0), rgba(0,0,0,0.8));14 }15 16 /* A darker variant of the above gradient to improve readability. */17 div.overlay-gradient-tall-dark {18   display: block;19   position: absolute;20   top: 0;21   left: 0;22   right: 0;23   bottom: 0;24   background: -webkit-linear-gradient(rgba(0,0,0,0.2) 30%, rgba(0,0,0,0.85) 100%);25 }26 27 /* For cards with one line of text (excluding footer)28  * ex: photos, videos, people29  */30 div.overlay-gradient-medium {31   display: block;32   position: absolute;33   top: 50%;34   left: 0;35   right: 0;36   bottom: 0;37   background: -webkit-linear-gradient(rgba(0,0,0,0.0), rgba(0,0,0,0.8));38 }39 40 /* For cards with low text41  * ex: footer, tooltips42  */43 div.overlay-gradient-short {44   display: block;45   position: absolute;46   top: 70%;47   left: 0;48   right: 0;49   bottom: 0;50   background: -webkit-linear-gradient(rgba(0,0,0,0.0), rgba(0,0,0,0.6));51 }52 53 /* For cards with full-height or near-full-height text on top of a photo or54  * mosiac. */55 div.overlay-full {56   display: block;57   position: absolute;58   top: 0;59   left: 0;60   right: 0;61   bottom: 0;62   background-color: rgba(0, 0, 0, 0.7);63 }

 

1 第一個樣式 <div class="overlay-gradient-tall"></div>

顯示效果如下:

 

1 第二個樣式 <div class="overlay-gradient-tall-dark"></div>

 

1 第三個樣式<div class="overlay-gradient-short"></div>

1 最後一個樣式(推薦)<div class="overlay-full"></div>

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.