實現卡片效果【DIV+CSS3】

來源:互聯網
上載者:User

標籤:實現   20px   white   tar   car   教程   網站   body   img   

一、文字卡片效果

 1 <html> 2 <head> 3 meta<charset="utf-8"> 4 <title>文字卡片效果</title> 5 <style> 6 div.card { 7 width: 250px; 8 box-shadow: 04px8px0rgba(0, 0, 0, 0.2), 06px20px0rgba(0, 0, 0, 0.19); 9 text-align: center;10 }?11 div.header {12 background-color: #4CAF50;13 color: white;14 padding: 10px;15 font-size: 40px;16 }?17 div.container {18 padding: 10px;19 }20 </style>21 </head>22 <body>23 <h2>卡片</h2>24 <p>box-shadow 屬性用來可以建立紙質樣式卡片:</p>?25 <divclass="card">26 <divclass="header">27 <h1>1</h1>28 </div>29 <divclass="container">30 <p>January 1, 2016</p>31 </div>32 </div>?33 </body>34 </html>

效果如下:

二、圖片卡片效果

 1 <!DOCTYPE html> 2 <html> 3     <head> 4         <meta charset="UTF-8"> 5         <title>圖片卡片效果</title> 6         <style> 7             div.imgcard{ 8                 width: 250px; 9                 box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2), 0 6px 20px 0 rgba(0,0,0,0.19);10                 text-align: center;11             }12             13             div.container{14                 padding: 10px;15             }16         </style>17     </head>18     <body>19         <div class="imgcard">20             <img src="background.png" style="width:100%"/>21             <div class="container">22                 <p>歡迎來到W星系</p>23             </div>24         </div>25     </body>26 </html>

效果如下:

 特別說明:本系列持續連載,不定期分享更新,參考自菜鳥教程(一個神奇的網站)!!!

實現卡片效果【DIV+CSS3】

聯繫我們

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