css 手写边框角

本文介绍了一种利用CSS的linear-gradient和HTML元素来构建四角边框的方法。通过设置不同方向的渐变背景和重复,以及利用绝对定位的子元素来微调边框细节,实现了自定义边框的效果。示例代码详细展示了如何创建顶部、底部、左侧和右侧的边框元素。
摘要由CSDN通过智能技术生成

background:使用linear-gradient 搭建四个角

background:
     linear-gradient(#000,#000) left top,
     linear-gradient(#000,#000) left top,
     linear-gradient(#000,#000) right top,
     linear-gradient(#000,#000) right top,
     linear-gradient(#000,#000) right bottom,
     linear-gradient(#000,#000) right bottom,
     linear-gradient(#000,#000) left bottom,
     linear-gradient(#000,#000) left bottom;
background-repeat:no-repeat;
background-size:5px 20px, 20px,5px;

border 配合 absolute 属性来进行四个边角的 搭建 再给四个角八个边 设置对应的长度宽度,定位等信息 在进行微调即可

<style>
    .t_line{
        position:absoult;
        background-color:#4788fb;
        box-shadow:0 0 10px #4788fb;
    }
    
    .l_t_line{
        width:5px;
        height:20px;
        left:-3px;
        top:-3px;
    }

 .t_l_line{
        width: 20px;
        height: 5px;
        background-color: #4788fb;
        left: -3px;
        top: -3px;
    }
    .r_t_line{
        width: 5px;
        height: 20px;
        background-color: #4788fb;
        right: 27px;
        top: -3px;
    }
    .t_r_line{
        width: 20px;
        height: 5px;
        background-color: #4788fb;
        right: 27px;
        top: -3px;
    }
    .l_b_line{
        width: 5px;
        height: 20px;
        background-color: #4788fb;
        left: -3px;
        bottom:18px;
    }
    .b_l_line{
        width: 20px;
        height: 5px;
        background-color: #4788fb;
        left: -3px;
        bottom: 18px;
    }

    .r_b_line{
        width: 5px;
        height: 20px;
        background-color: #4788fb;
        right: 27px;
        bottom: 18px;
    }
    .b_r_line{
        width: 20px;
        height: 5px;
        background-color: #4788fb;
        right: 27px;
        bottom: 18px;
    }
</style>  
              <div>
                <div class="t_line">
                    <i class="l_t_line"></i>
                    <i class="t_l_line"></i>
                </div>
                 <div class="t_line">
                    <i class="r_t_line"></i>
                    <i class="t_r_line"></i>
                </div>
                 <div class="t_line">
                    <i class="l_b_line"></i>
                    <i class="b_l_line"></i>
                </div>
                 <div class="t_line">
                    <i class="r_b_line"></i>
                    <i class="b_r_line"></i>
                </div>
            </div>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值