DIV+CSS實現圓角

來源:互聯網
上載者:User
原理就是在一個層上加二到三個層,不過這些層只有左右邊線,最上和最下有背景色,然後它們都有長度差距,就這樣了,以下是我做的例子:

<html
<head>
    <title>無標題頁</title>
    <style>
.up1
{
    overflow:hidden;
    height:1px;
    margin-left:4px;
    margin-right:4px;
    background-color: Aqua;
    border-left:solid 1px Aqua;
    border-right:solid 1px Aqua;
}
.up2
{
    overflow:hidden;
    height:1px;
    margin-left:3px;
    margin-right:3px;
    border-left:solid 1px Aqua;
    border-right:solid 1px Aqua;
}
.up3
{
    overflow:hidden;
    height:1px;
    margin-left:2px;
    margin-right:2px;
    border-left:solid 1px Aqua;
    border-right:solid 1px Aqua;
}
.content
{
    margin-left:1px;
    margin-right:1px;
    height:100px;/*這裡控制項高度*/
    /*background-color: Aqua;*/
    border-left:solid 1px Aqua;
    border-right:solid 1px Aqua;
}
.down1
{
    overflow:hidden;
    height:1px;
    margin-left:2px;
    margin-right:2px;
    border-left:solid 1px Aqua;
    border-right:solid 1px Aqua;
}
.down2
{
    overflow:hidden;
    height:1px;
    margin-left:3px;
    margin-right:3px;
    border-left:solid 1px Aqua;
    border-right:solid 1px Aqua;
}
.down3
{
    overflow:hidden;
    height:1px;
    margin-left:4px;
    margin-right:4px;
    background-color: Aqua;
    border-left:solid 1px Aqua;
    border-right:solid 1px Aqua;
}
.cell
{
    width: 50px;/*這裡控制寬度*/
}


</style>
</head>
<body>
    <div class="cell">
        <div class="up1">
        </div>
        <div class="up2">
        </div>
        <div class="up3">
        </div>
        <div class="content">
            這裡放內容
        </div>
        <div class="down1">
        </div>
        <div class="down2">
        </div>
        <div class="down3">
        </div>
    </div>
</body>
</html>

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.