本篇文章展示了css3實(shí)現(xiàn)三角形的具體操作,代碼簡明扼要容易理解,絕對能讓你眼前一亮,通過這篇文章的詳細(xì)介紹希望你能有所收獲。
創(chuàng)新互聯(lián)堅(jiān)持“要么做到,要么別承諾”的工作理念,服務(wù)領(lǐng)域包括:網(wǎng)站建設(shè)、網(wǎng)站設(shè)計(jì)、企業(yè)官網(wǎng)、英文網(wǎng)站、手機(jī)端網(wǎng)站、網(wǎng)站推廣等服務(wù),滿足客戶于互聯(lián)網(wǎng)時(shí)代的蒲江縣網(wǎng)站設(shè)計(jì)、移動媒體設(shè)計(jì)的需求,幫助企業(yè)找到有效的互聯(lián)網(wǎng)解決方案。努力成為您成熟可靠的網(wǎng)絡(luò)建設(shè)合作伙伴!css3三角形使用場景
我們知道有一個(gè)特效是span下拉列表,也就是說當(dāng)鼠標(biāo)放上一個(gè)div時(shí),會出現(xiàn)原本隱藏的內(nèi)容或者二級菜單,這樣一個(gè)下拉列表會突出來一個(gè)小的三角形指向原本的div區(qū)域塊,如圖所示:
那么我們現(xiàn)在來總結(jié)一下,我們是如何寫出這些三角形的。
CSS3三角形實(shí)現(xiàn)原理
在css3中,我們主要使用的是一個(gè)transparent的屬性,意思是透明的,比如我們將字體設(shè)置為黑色會寫color:black,那么如果想把字體的顏色設(shè)置為透明,我們可以寫color:transparent。同理background-color:transparent可以設(shè)置背景為透明。
三角形8種分類
我們根據(jù)三角形的位置分為8種:
triangle up,triangle down,triangle left,triangle right,triangle top left,triangle top right,triangle bottom left和triangle bottom right。
8種三角形實(shí)現(xiàn)實(shí)例
1.triangle up 上三角形
#triangle-up{ width:0; height:0; border-left:50px solid transparent; border-right:50px solid transparent; border-bottom:100px solid black; }
2.triangle down 下三角形
#triangle-down{ width:0; height:0; border-left:50px solid transparent; border-right:50px solid transparent; border-top:100px solid black; }
3.triangle left 左三角形
#triangle-left{ width:0; height:0; border-top:50px solid transparent; border-bottom:50px solid transparent; border-right:100px solid black; }
4.triangle right 右三角形
#triangle-right{ width:0; height:0; border-top:50px solid transparent; border-bottom:50px solid transparent; border-left:100px solid black; }
5.triangle top left 左上三角形
#triangle-topleft{ width:0; height:0; border-top:100px solid black; border-right:100px solid transparent; }
6.triangle top right 右上三角形
#triangle-topright{ width:0; height:0; border-top:100px solid black; border-left:100px solid transparent; }
7.triangle bottom left 左下三角形
#triangle-bottomleft{ width:0; height:0; border-bottom:100px solid black; border-right:100px solid transparent; }
8.triangle bottom right 右下三角形
#triangle-bottomright{ width:0; height:0; border-bottom:100px solid black; border-left:100px solid transparent; }
大致的效果如圖所示:
看完上述內(nèi)容,你們掌握css3實(shí)現(xiàn)三角形的方法了嗎?如果還想學(xué)到更多技能或想了解更多相關(guān)內(nèi)容,歡迎關(guān)注創(chuàng)新互聯(lián)成都網(wǎng)站設(shè)計(jì)公司行業(yè)資訊頻道,感謝各位的閱讀!
另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場景需求。
文章題目:css3怎么實(shí)現(xiàn)三角形-創(chuàng)新互聯(lián)
URL鏈接:http://www.rwnh.cn/article4/csjioe.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站內(nèi)鏈、虛擬主機(jī)、微信公眾號、App設(shè)計(jì)、云服務(wù)器、營銷型網(wǎng)站建設(shè)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容