实际编码以下所显示:
html编码是那样的 <div class="arrow-up"> <!--往上的三角--> </div> <div class="arrow-down"> <!--往下的三角--> </div> <div class="arrow-left"> <!--向左的三角--> </div> <div class="arrow-right"> <!--向右的三角--> </div> 下边用CSS3各自完成往上、下、左、右的三角形 /*箭头符号往上*/ .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> 个性特征:牛上脑是坐落于肩头颈靠后,脊骨两边的牛羊肉,肉质鲜嫩多汁,人体脂肪杂交匀称,有漂亮的云南大理石纹路,口感柔软,通道即化,人体脂肪低而蛋白质质成分高,合适涮火锅,可煎炸,炸和烤串。 </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; */ }
小结
到此这篇有关纯CSS3+DIV完成小三角形外框的文章内容就详细介绍到这了,大量有关css div 完成三角形外框內容请检索脚本制作之家之前的文章内容或再次访问下边的有关文章内容,期待大伙儿之后多多的适用脚本制作之家!