純CSS3+DIV實(shí)現(xiàn)小三角形邊框效果的示例代碼
發(fā)布時(shí)間:2020-08-03 15:28:35 作者:子欽加油
我要評(píng)論
這篇文章主要介紹了純CSS3+DIV實(shí)現(xiàn)小三角形邊框,本文通過實(shí)例代碼給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
具體代碼如下所示:
html代碼是這樣的
<div class="arrow-up">
<!--向上的三角-->
</div>
<div class="arrow-down">
<!--向下的三角-->
</div>
<div class="arrow-left">
<!--向左的三角-->
</div>
<div class="arrow-right">
<!--向右的三角-->
</div>
下面用CSS3分別實(shí)現(xiàn)向上、下、左、右的三角形
/*箭頭向上*/
.arrow-up {
width:0;
height:0;
border-left:30px solid transparent;
border-right:30px solid transparent;
border-bottom:30px solid #fff;
}
/*箭頭向下*/
.arrow-down {
width:0;
height:0;
border-left:20px solid transparent;
border-right:20px solid transparent;
border-top:20px solid #0066cc;
}
/*箭頭向左*/
.arrow-left {
width:0;
height:0;
border-top:30px solid transparent;
border-bottom:30px solid transparent;
border-right:30px solid yellow;
}
/*箭頭向右*/
.arrow-right {
width:0;
height:0;
border-top:50px solid transparent;
border-bottom: 50px solid transparent;
border-left: 50px solid green;
}
小程序示例

wxml
<view class="index_sale_lists">
<view class="sanjiao"></view>
<view class="index_sale_list">
<view class="index_sale_choice">你已選擇:<text>上腦</text></view>
<view class="index_sale_tezhi">
<text>
特質(zhì):牛上腦是位于肩頸部靠后,脊骨兩側(cè)的牛肉,肉質(zhì)細(xì)嫩多汁,脂肪雜交均勻,有好看的大理石花紋,口感綿軟,入口即化,脂肪低而蛋白質(zhì)含量高,適合涮火鍋,可煎炸,炸和燒烤。
</text>
</view>
</view>
</view>
wxss
.index_sale_lists{
margin: 50rpx 24rpx 0;
background-color: #F2F6F4;
border-radius: 20rpx;
position: relative;
}
.sanjiao{
position: absolute;
left: 50%;
top:-15rpx;
width:0;
height:0;
border-left:10px solid transparent;
border-right:10px solid transparent;
border-bottom:10px solid #F2F6F4;
/* z-index:-1; */
}
總結(jié)
到此這篇關(guān)于純CSS3+DIV實(shí)現(xiàn)小三角形邊框的文章就介紹到這了,更多相關(guān)css div 實(shí)現(xiàn)三角形邊框內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持腳本之家!
相關(guān)文章

詳解css如何利用 :before :after 寫小三角形
這篇文章主要介紹了詳解css如何利用 :before :after 寫小三角形的相關(guān)資料,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2018-01-22- 這篇文章主要介紹了CSS3 畫基本圖形,圓形、橢圓形、三角形等的相關(guān)資料,需要的朋友可以參考下2016-09-20
- 這篇文章主要介紹了用CSS3繪制三角形的簡單方法,是CSS前端繪圖的基礎(chǔ),需要的朋友可以參考下2015-07-17
布局和排版教程 純css3實(shí)現(xiàn)圖片三角形排列
圖片的布局和排版非常重要,純大部分網(wǎng)頁或多或少都會(huì)用到圖片。特別是對(duì)于圖片較多的網(wǎng)頁,今天要給大寫帶來一款純css3實(shí)現(xiàn)圖片三角形排列。適合一系列的圖片,需要的朋友2014-10-17使用css創(chuàng)建三角形 使用CSS3創(chuàng)建3d四面體原理及代碼(html5實(shí)踐)
今天讀了篇關(guān)于如何使用css3創(chuàng)建3d四面體的文章,覺的相當(dāng)不錯(cuò),所以拿出來和大家分享一下,如何使用div+css創(chuàng)建三角形。在這里我先把相關(guān)代碼粘貼出來,然后再為大家講解2013-01-06
這篇文章主要介紹了CSS3實(shí)現(xiàn)三角形不斷放大效果,本文通過實(shí)例代碼給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2021-04-13



