如何利用css实现圆环效果


本文摘自PHP中文网,作者V,侵删。

css实现圆环效果有多种方法,这里为大家分享五种方法:

(推荐教程:CSS教程)

首先我们来看一下实现效果:

d03382e71b96b7d8bc5b748b2931994.png

接下来为大家介绍方法:

1、两个标签的嵌套

1

2

3

<div class="element1">

    <div class="child1"></div>

</div>

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

.element1{

            width: 200px;

            height: 200px;

            background-color: lightpink;

            border-radius: 50%;

        }

        .child1{

            width: 100px;

            height: 100px;

            border-radius: 50%;

            background-color: #009966;

            position: relative;

            top: 50px;

            left: 50px;

        }

2、使用伪元素,before/after

1

<div class="element2"></div>

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

.element2{

            width: 200px;

            height: 200px;

            background-color: lightpink;

            border-radius: 50%;

        }

        .element2:after{

            content: "";

            display: block;

            width: 100px;

            height: 100px;

            border-radius: 50%;

            background-color: #009966;

            position: relative;

            top: 50px;

            left: 50px;

        }

3、使用border:

1

<div class="element3"></div>

1

2

3

4

5

6

7

.element3{

           width: 100px;

           height: 100px;

           background-color: #009966;

           border-radius: 50%;

           border: 50px solid lightpink ;

       }

(学习视频推荐:css视频教程)

阅读剩余部分

相关阅读 >>

css如何实现滑动门效果

css内边距是什么

css操作控件实现disable效果

css怎么在图片上显示遮罩层

css背景图片怎么自适应

css中隐藏元素的方法有哪些?有什么区别?

css怎么让文字在底部对齐

css的引入方式有哪些

css如何设置字体粗细

div在屏幕中如何实现水平居中和垂直居中

更多相关阅读请进入《css》频道 >>




打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...