css闭合箭头DIV

本文详细介绍了如何利用CSS3的属性和技巧,创建出一款精美的闭合箭头效果。通过控制边框颜色和宽度,结合伪元素的选择器,可以实现不同方向的箭头,并且能够完美融入各种布局中。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

在这里插入图片描述

<style>
                    .test{
                        height:40px;
                        background:#a29576;
                        color:#fff;
                        position:relative;
                        width:40%;
                        text-align:center;
                        line-height:40px;
                        display: inline-block;
                        border-top-left-radius: 20px;
                        border-bottom-left-radius: 20px;
                    }
                    .test:after{
                        content:"";
                        position:absolute;
                        height:0;
                        width:0;
                        left:100%;
                        top:0;
                        border:20px solid transparent;
                        border-left: 20px solid #a29576;
                    }
                    .test2{
                        height:40px;
                        background:#a70202;
                        color:#fff;
                        position:relative;
                        width:40%;
                        text-align:center;
                        line-height:40px;
                        display: inline-block;
                        margin-left: 40px;
                        border-top-right-radius: 20px;
                        border-bottom-right-radius: 20px;
                    }
                    .test2:before{
                        content: "";
                        position: absolute;
                        height: 0;
                        width: 0;
                        left: -46px;
                        top: 0;
                        border: 20px solid transparent;
                        border-right: 26px solid #a70202;
                        border-top: 20px solid #a70202;
                        border-bottom: 20px solid #a70202;
                    }
                    
                </style>
                <div>
                    <div class="test"></div>
                    <div class="test2"></div>
                </div>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值