用css來寫一些簡單的圖形

來源:互聯網
上載者:User

標籤:absolute   ati   ros   bottom   back   relative   parent   osi   content   

在寫網頁的過程中,有時我們需要用到一些簡單的圖片但是手頭又沒有合適的,我們其實可以自己來寫,下面我就簡單的介紹幾個例子:

1.上三角

Triangle Up

#triangle-up {

width: 0; height: 0; border-left: 50px solid transparent; border-right: 50px solid transparent; border-bottom: 100px solid red; }

2.下三角

Triangle Down

#triangle-down {

width: 0; height: 0; border-left: 50px solid transparent; border-right: 50px solid transparent; border-top: 100px solid red; }

3.左三角

Triangle left

#triangle-left {

width: 0; height: 0; border-top: 50px solid transparent; border-right: 100px solid red; border-bottom: 50px solid transparent; }

4.右三角

Triangle right

#triangle-right {

width: 0; height: 0; border-top: 50px solid transparent; border-left: 100px solid red; border-bottom: 50px solid transparent; }

5.左上直角

Triangle Top Left

#triangle-topleft {

width: 0; height: 0; border-top: 100px solid red; border-right: 100px solid transparent; }

6.右上直角

Triangle Top Right

#triangle-topright { width: 0; height: 0; border-top: 100px solid red; border-left: 100px solid transparent; }

7.左下直角

Triangle Bottom Left

#triangle-bottomleft {

width: 0; height: 0; border-bottom: 100px solid red; border-right: 100px solid transparent; }

8.右下直角

Triangle Bottom Right

#triangle-bottomright {

width: 0; height: 0; border-bottom: 100px solid red; border-left: 100px solid transparent; }

 

 

最後來一個稍微複雜一點點的

十字架

Cross

#cross {

background: red; height: 100px; position: relative; width: 20px; } #cross:after { background: red; content: ""; height: 20px; left: -40px; position: absolute; top: 40px; width: 100px; }

用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.