首页 > 其他 > 详细

边框内圆角实现方法

时间:2017-02-07 15:08:09      阅读:186      评论:0      收藏:0      [点我收藏+]

方法一: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>

 

边框内圆角实现方法

原文:http://www.cnblogs.com/loveyunk/p/6374076.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!