css3標籤頁學習製作

來源:互聯網
上載者:User

標籤:

本文是學習w3cplus上的一篇文章的心得體會,連結見底部。

具體實現的效果為:

1、樣式一較為簡單:

主要運用border-radius

 

2、樣式二可拆分為一個矩形和一個三角形;

HTML為:

1 <h3 style="text-align:center;">Flag</h3>2 <div class="flag"></div>

css為:

 1 .flag{width: 110px; 2   height: 156px; 3   padding-top: 15px; 4   position: relative;  5   background: red; 6   margin:0 auto; 7     } 8 .flag:after{ /*  一個長方形+一個朝上的三角形 */ 9 content: "";10   position: absolute;11   left: 0;12   bottom: 0;13   width: 0;14   height: 0;15   border-bottom: 23px solid #fff;16   border-left: 55px solid transparent;17   border-right: 55px solid transparent;    }

效果為:

那樣式二就較為簡單了:

具體見代碼,HTML為:

1 <div class="demo tag2">2     <p>我有一隻小毛驢 我從來也不騎 有一天我心血來潮 騎著去趕集 我手裡拿著小皮鞭 我心裡正得意 不知怎麼嘩拉拉拉 我摔了一身泥我有一隻小毛驢 我從來也不騎 有一天我心血來潮 騎著去趕集 我手裡拿著小皮鞭 我心裡正得意 不知怎麼嘩拉拉拉 我摔了一身泥</p>3     <div class="demo2"><a>what</a><a>are you</a><a>saying</a></div>4 </div>

css為:

 1 /* demo2 */ 2 .demo2{ left:-73px; top:10px;} 3 .demo2 a{ 4     background-color:#03AEC7; 5     color:#fff; 6     text-shadow:0 -1px 0 rgba(0,0,0,.2); 7     position:relative; 8     display:block; 9     margin:0 0 10px;10     -webkit-box-shadow:-5px 0 5px -5px rgba(0, 0, 0, 0.3) inset;11     -moz-box-shadow:-5px 0 5px -5px rgba(0, 0, 0, 0.3) inset;12     box-shadow:-5px 0 5px -5px rgba(0, 0, 0, 0.3) inset;13     14     }15 .demo2 a:before{16     content:‘‘;17     width:0;18     height:0;19     position:absolute;20     left:-10px;21     top:0;22     border-left:10px solid transparent;23     border-top:12px solid #03AEC7;24     border-bottom:12px solid #03AEC7;25     26     }

3、樣式三可拆解為一個矩形+一個三角形+一個小圓;

三角形的實現前面已經說過了,小圓就是運用border-radius=邊長即可;

HTML為:

1 <div class="demo tag3">2     <p>我有一隻小毛驢 我從來也不騎 有一天我心血來潮 騎著去趕集 我手裡拿著小皮鞭 我心裡正得意 不知怎麼嘩拉拉拉 我摔了一身泥我有一隻小毛驢 我從來也不騎 有一天我心血來潮 騎著去趕集 我手裡拿著小皮鞭 我心裡正得意 不知怎麼嘩拉拉拉 我摔了一身泥</p>3     <div class="demo3"><a>what</a><a>are you</a><a>saying</a></div>4 </div>

css為:

 1 /* demo3 */     2 .demo3 a{ 3     background-color:#F89406; 4     color:#fff; 5     text-shadow:0 -1px 0 rgba(0,0,0,.2); 6     position:relative; 7      8     } 9 .demo3 a:before{10     content:‘‘;11     width:0;12     height:0;13     border-right:10px solid #F89406;14     border-top:12px solid transparent;15     border-bottom:12px solid transparent;16     position:absolute;17     left:-10px;18     top:0;19     20     }21 .demo3 a:after{22      content:‘‘;23      width:4px;24      height:4px;25      border-radius:4px;26      position:absolute;27      left:-4px;28      background:#fff;29      top:10px;30     31     32     33     34     }

大功告成,呱唧呱唧.

w3cplus  demo連結為:http://www.w3cplus.com/demo/384.html

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.