HTML5基础加强css样式篇(css属性border圆角:border-radius)(三十五)

1.制作圆角:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
    <style type="text/css">
        .box {
            /* .box 默认样式 */
            margin: 200px 0 0 200px;
            width: 200px;
            height: 200px;
            background-color: orange;
            /*①*/
            border-radius: 50px;
	/*②*/
            border-radius: 50px 20px;
	 /*③*/
            border-radius: 50px 20px 5px;
	 /*④*/
            border-radius: 50px 20px 5px 80px; 
        }

        .box:hover {
            /* 鼠标悬浮时样式 */

        }
    </style>
</head>
<body>

<div class="box"></div>

<script type="text/javascript">
</script>
</body>
</html>
效果如下:

2.使用圆角制作椭圆:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
    <style type="text/css">
        .box {
            /* .box 默认样式 */
            margin: 200px 0 0 200px;
            width: 400px;
            height: 200px;
            background-color: orange;

            /*border-radius: 水平半径 / 垂直半径*/
            border-radius: 200px/100px;

            border-radius: 200px 50px/ 100px 5px;
            border-radius: 200px 50px 10px / 100px 5px 60px;

        }

        .box:hover {
            /* 鼠标悬浮时样式 */

        }
    </style>
</head>
<body>

<div class="box"></div>

<script type="text/javascript">
</script>
</body>
</html>

效果:



3.画1/4圆代码如下:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
    <style type="text/css">
        .box {
            /* .box 默认样式 */
            margin: 200px 0 0 200px;
            width: 200px;
            height: 200px;
            background-color: orange;

            border-radius: 200px 0 0 0;
        }

        .box:hover {
            /* 鼠标悬浮时样式 */

        }
    </style>
</head>
<body>

<div class="box"></div>

<script type="text/javascript">
</script>
</body>
</html>
效果如下:

4.画一个半圆:

代码如下:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
    <style type="text/css">
        .box {
            /* .box 默认样式 */
            margin: 200px 0 0 200px;
            width: 400px;
            height: 200px;
            background-color: orange;

            border-radius: 200px 200px 0 0;
        }

        .box:hover {
            /* 鼠标悬浮时样式 */

        }
    </style>
</head>
<body>

<div class="box"></div>

<script type="text/javascript">
</script>
</body>
</html>

效果图如下:


5.border中百分比的使用:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
    <style type="text/css">
        .box {
            /* .box 默认样式 */
            margin: 200px 0 0 200px;
            width: 200px;
            height: 200px;
            background-color: orange;
            border: 20px solid #0000ff;

            border-radius: 100px;

            /*推荐使用%设置圆角半径,可以随着元素大小动态调整*/
            border-radius: 50%;

            /*border-radius: 120px;*/
        }

        .box:hover {
            /* 鼠标悬浮时样式 */

        }
    </style>
</head>
<body>

<div class="box"></div>

<script type="text/javascript">
</script>
</body>
</html>
效果图:

6.border旋转效果:


<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
    <style type="text/css">
        .box {
            /* .box 默认样式 */
            margin: 200px 0 0 200px;
            width: 200px;
            height: 200px;
            /*background-color: orange;*/

            /*border: 20px solid;*/
            border-top: 20px solid orange;
            border-right: 20px solid orange;

            border-bottom: 20px solid #7e64ff;
            border-left: 20px solid #7e64ff;


            border-radius: 50%;

        }

        .box-txt{
            width: 200px;
            height: 200px;
            line-height: 200px;
            text-align: center;
        }

        .box:hover{
            transform: rotate(360deg);
            transition: 5s;
        }
        .box:hover .box-txt{//使文字逆时针旋转保持文字不动
            transform: rotate(-360deg);
            transition: 5s;
        }


    </style>
</head>
<body>

<div class="box">
    <div class="box-txt">Hello</div>
</div>

<script type="text/javascript">
</script>
</body>
</html>
效果图如下:



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

咸鸭蛋炒饭

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值