zoukankan      html  css  js  c++  java
  • 边框内圆角实现方法

    边框内圆角效果

    方法一:div嵌套法

    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <title>边框内圆角</title>
        <link rel="stylesheet" href="">
        <style>
            .box {
                width: 300px;
                height: 100px;
                background: rgb(107,89,86);
                position: relative;
            }
            .inner-box {
                background: rgb(216,193,187);
                position: absolute;
                top: 10px;
                bottom: 10px;
                right: 10px;
                left: 10px;
                border-radius: 10px;
            }
        </style>
    </head>
    <body>
        <div class="box">
            <div class="inner-box"></div>
        </div>
    </body>
    </html>

    方法二:ouline与box-shadow

    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <title>边框内圆角</title>
        <link rel="stylesheet" href="">
        <style>
            .box {
                width: 300px;
                height: 100px;
                margin: 20px;
                background: tan;
                outline: 10px solid #655;
                border-radius: 10px;
                box-shadow: 0 0 0 10px #655;
            }
        </style>
    </head>
    <body>
        <div class="box"></div>
    </body>
    </html>

    方法三:伪元素法

    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <title>边框内圆角</title>
        <link rel="stylesheet" href="">
        <style>
            .box {
                width: 300px;
                height: 100px;
                background: rgb(216,193,187);
                border-radius: 20px;
                padding: 10px;
                background-clip: content-box;
                position: relative;
            }
            .box::before {
                content: '';
                position: absolute;
                top: 0;
                right: 0;
                bottom: 0;
                left: 0;
                background: rgb(107,89,86);
                z-index: -1;
            }
        </style>
    </head>
    <body>
        <div class="box"></div>
    </body>
    </html>
  • 相关阅读:
    反射
    IDEA配置数据库
    配置idea的maven镜像为aliyun
    蓝桥---芯片测试(思维)
    汉诺塔(思维、DP思想)
    立方数(质因子、优化)
    碎碎念(DP)
    牛牛战队的比赛地(三分)
    子段乘积(尺取、逆元)
    子段异或(位运算)
  • 原文地址:https://www.cnblogs.com/loveyunk/p/6374076.html
Copyright © 2011-2022 走看看