zoukankan      html  css  js  c++  java
  • CSS3边框 圆角效果 borderradius

     border-radius是向元素添加圆角边框

    使用方法:

    border-radius:10px; /* 所有角都使用半径为10px的圆角 */ 

    border-radius: 5px 5px 5px 5px; /* 四个半径值分别是左上角、右上角、右下角和左下角,顺时针 */ 

    不要以为border-radius的值只能用px单位,你还可以用百分比或者em,但兼容性目前还不太好。

    实心上半圆:

    方法:把高度(height)设为宽度(width)的一半,并且只设置左上角和右上角的半径与元素的高度一致(大于也是可以的)。

    div{
        height:50px;/*是width的一半*/
        100px;
        background:#9da;
        border-radius:50px 50px 0 0;/*半径至少设置为height的值*/
        }

    实心圆:
    方法:把宽度(width)与高度(height)值设置为一致(也就是正方形),并且四个圆角值都设置为它们值的一半。如下代码:

    div{
        height:100px;/*与width设置一致*/
        100px;
        background:#9da;
        border-radius:50px;
        }

    实心下半圆:

    方法:把高度(height)设为宽度(width)的一半,并且只设置左下角和右下角的半径与元素的高度一致(大于也是可以的)。

    div.circle2{
    height:50px;
    100px;
    background:#9da;
    border-radius:0 0 50px 50px;
    }

    实心左半圆:

    方法:把宽度(width)设为高度(height)的一半,并且只设置左上角和左下角的半径与元素的高度一致(大于也是可以的)。

    div.circle2{
    height:50px;
    100px;
    background:#9da;
    border-radius:50px 0 0 50px;
    }

    实例右半圆:

    方法:把宽度(width)设为高度(height)的一半,并且只设置右上角和右下角的半径与元素的高度一致(大于也是可以的)。

    div.circle2{
    height:50px;
    100px;
    background:#9da;
    border-radius:0 50px 50px 0;
    }
    代码演示:
    <!doctype html>
    <html>
    <head>
        <meta charset="utf-8">
        <title>border-radius</title>
        <style type="text/css">
            div.circle{
                height:50px;/*是width的一半*/
                100px;
                background:#9da;
                border-radius:50px 50px 0 0;/*半径至少设置为height的值*/
            }
            div.circle1{
                height:100px;/*与width设置一致*/
                100px;
                background:#9da;
                border-radius:50px;
            }
            div.circle2{
                height:50px;
                100px;
                background:#9da;
                border-radius:0 0 50px 50px;
            }
            div.circle3{
                height:100px;
                50px;
                background:#9da;
                border-radius:50px 0 0 50px;
            }
            div.circle4{
                height:100px;

    50px; background:#9da; border-radius:0px 50px 50px 0px; } </style> </head> <body> <div class="circle"> </div> <br/> <div class="circle1"> </div> <br> <div class="circle2"> </div> <br> <div class="circle3"> </div> <br> <div class="circle4"> </div> <br> </body> </html>

    转载:http://www.imooc.com/code/380



  • 相关阅读:
    C# 中国日历 农历 阳历 星座 二十四节气 二十八星宿 节日 天干地支
    C# AutoMapper:流行的对象映射框架,可减少大量硬编码,很小巧灵活,性能表现也可接受。
    Asp.net webapi 判断请求参数是否为空简易方法 Model Validation 判断请求参数是否为空
    IIS本地部署局域网可随时访问的项目+mysql可局域网内访问
    jquery ajax return不起作用
    asp.net webapi 给字段赋初始值DefaultValue 解决前端传空字符串后台接受不是“”而是NULL
    git log的常用命令
    C++面试题集合(持续更新)
    python的with用法(转载)
    stage_ros的world文件配置方法
  • 原文地址:https://www.cnblogs.com/guangzhou11/p/7336964.html
Copyright © 2011-2022 走看看