純CSS繪制三角形(各種角度)
更新時(shí)間:2013年10月29日 09:55:47 作者:
CSS三角形繪制方法,學(xué)會(huì)了這個(gè),其它的也就簡(jiǎn)單。
我們的網(wǎng)頁因?yàn)?CSS 而呈現(xiàn)千變?nèi)f化的風(fēng)格。這一看似簡(jiǎn)單的樣式語言在使用中非常靈活,只要你發(fā)揮創(chuàng)意就能實(shí)現(xiàn)很多比人想象不到的效果。特別是隨著 CSS3 的廣泛使用,更多新奇的 CSS 作品涌現(xiàn)出來。
今天給大家?guī)?CSS 三角形繪制方法

#triangle-up {
width: 0;
height: 0;
border-left: 50px solid transparent;
border-right: 50px solid transparent;
border-bottom: 100px solid red;
}
#triangle-down {
width: 0;
height: 0;
border-left: 50px solid transparent;
border-right: 50px solid transparent;
border-top: 100px solid red;
}
#triangle-left {
width: 0;
height: 0;
border-top: 50px solid transparent;
border-right: 100px solid red;
border-bottom: 50px solid transparent;
}
#triangle-right {
width: 0;
height: 0;
border-top: 50px solid transparent;
border-left: 100px solid red;
border-bottom: 50px solid transparent;
}
#triangle-topleft {
width: 0;
height: 0;
border-top: 100px solid red;
border-right: 100px solid transparent;
}
#triangle-topright {
width: 0;
height: 0;
border-top: 100px solid red;
border-left: 100px solid transparent;
}
#triangle-bottomleft {
width: 0;
height: 0;
border-bottom: 100px solid red;
border-right: 100px solid transparent;
}
#triangle-bottomright {
width: 0;
height: 0;
border-bottom: 100px solid red;
border-left: 100px solid transparent;
}
今天給大家?guī)?CSS 三角形繪制方法

復(fù)制代碼 代碼如下:
#triangle-up {
width: 0;
height: 0;
border-left: 50px solid transparent;
border-right: 50px solid transparent;
border-bottom: 100px solid red;
}
復(fù)制代碼 代碼如下:
#triangle-down {
width: 0;
height: 0;
border-left: 50px solid transparent;
border-right: 50px solid transparent;
border-top: 100px solid red;
}
復(fù)制代碼 代碼如下:
#triangle-left {
width: 0;
height: 0;
border-top: 50px solid transparent;
border-right: 100px solid red;
border-bottom: 50px solid transparent;
}
復(fù)制代碼 代碼如下:
#triangle-right {
width: 0;
height: 0;
border-top: 50px solid transparent;
border-left: 100px solid red;
border-bottom: 50px solid transparent;
}
復(fù)制代碼 代碼如下:
#triangle-topleft {
width: 0;
height: 0;
border-top: 100px solid red;
border-right: 100px solid transparent;
}
復(fù)制代碼 代碼如下:
#triangle-topright {
width: 0;
height: 0;
border-top: 100px solid red;
border-left: 100px solid transparent;
}
復(fù)制代碼 代碼如下:
#triangle-bottomleft {
width: 0;
height: 0;
border-bottom: 100px solid red;
border-right: 100px solid transparent;
}
復(fù)制代碼 代碼如下:
#triangle-bottomright {
width: 0;
height: 0;
border-bottom: 100px solid red;
border-left: 100px solid transparent;
}
相關(guān)文章
HTML 絕對(duì)路徑與相對(duì)路徑概念詳細(xì)
這篇文章主要介紹了HTML 絕對(duì)路徑與相對(duì)路徑概念詳細(xì),本篇文章通過簡(jiǎn)要的案例,講解了該項(xiàng)技術(shù)的了解與使用,以下就是詳細(xì)內(nèi)容,需要的朋友可以參考下2021-08-08