純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)文章
CSS網(wǎng)頁布局入門教程6:左列固定,右列寬度自適應(yīng)
CSS網(wǎng)頁布局入門教程6:左列固定,右列寬度自適應(yīng)...2007-09-09
CSS網(wǎng)頁布局入門教程13:下拉及多級(jí)彈出式菜單
CSS網(wǎng)頁布局入門教程13:下拉及多級(jí)彈出式菜單...2007-09-09

