css如何制作圆

在css中,可以利用border-radius属性来制作圆;border-radius属性可以为元素添加圆角边框,只需要给宽高相同的正方形元素的设置“border-radius: 100%;”样式即可。

css如何制作圆

本教程操作环境:windows7系统、CSS3&&HTML5版、Dell G3电脑。

p+Css制作四分之一圆主要是使用Css3.0中的border-radius这个圆角隐藏属性.利用这一属性,我们可以画圆,画半圆,四分之三圆,四分之一圆等.以后我会更新……

如何使用border-radius属性,下面是border-radius属性最基本的使用方法:

  1. .round {    border-radius: 5px; /* 所有角都使用半径为5px的圆角,此属性为CSS3标准属性 */    -moz-border-radius: 5px; /* Mozilla浏览器的私有属性 */    -webkit-border-radius: 5px; /* Webkit浏览器的私有属性 */    border-radius: 5px 4px 3px 2px; /* 四个半径值分别是左上角、右上角、右下角和左下角 */}

登录后复制

1、用border-radius画圆:

立即学习“前端免费学习笔记(深入)”;

  1. #circle {    width: 200px;    height: 200px;    background-color: #a72525;    -webkit-border-radius: 100px;    /*-webkit-border-radius: 100%;*/}

登录后复制

仔细想想,一个正方形(200*200),里面最大的圆是的半径是:100.

css如何制作圆

2.空心圆代码:空心圆其实就是只有边框,空心部分填上其他颜色:

  1. #circle {    width: 200px;    height: 200px;    background-color: #efefef; /* Can be set to transparent */    border: 3px #a72525 solid;    -webkit-border-radius: 100px;}

登录后复制

css如何制作圆

同理虚线圆代码:

  1. #circle { width: 200px; height: 200px; background-color: #efefef; /* Can be set to transparent */ border: 3px #a72525 dashed; -webkit-border-radius: 100px 100px 100px 100px;}

登录后复制

css如何制作圆

3.半圆和四分之一圆代码:

  1. #quartercircle {    width: 200px;    height: 200px;    background-color: #a72525;    -webkit-border-radius: 200px 0 0 0;}

登录后复制

css如何制作圆

  1. nbsp;html>             <span class="typ">Document</span>   #quartercircle{ width: 200px; height: 200px; background-color: #ffffaa; border-radius:0 0 0 200px; -webkit-border-radius: 0 0 0 200px; -moz-border-radius: 0 0 0 200px; -ms-border-radius: 0 0 0 200px; -o-border-radius: 0 0 0 200px; } #quartercircle .dianxuan{ font-family:Arial; color:gray; font-size:25px; padding-top: 55px; padding-left: 90px; transform:rotate(32deg); -ms-transform:rotate(32deg); /* Internet Explorer */ -moz-transform:rotate(32deg); /* Firefox */ -webkit-transform:rotate(32deg); /* Safari 和 Chrome */ -o-transform:rotate(32deg); /* Opera */ }     
      
    点选
      
     

登录后复制

css如何制作圆

解释:

-moz(例如 -moz-border-radius)用于Firefox

-webkit(例如:-webkit-border-radius)用于Safari和Chrome

其中border-radius各个浏览器支持情况如表:

浏览器 支持性

Firefox(2、3+)√Google Chrome(1.0.154+…)√Google Chrome(2.0.156+…)√Safari(3.2.1+ windows)√Internet Explorer(IE7, IE8)×Opera 9.6×

(学习视频分享:css视频教程)

以上就是css如何制作圆的详细内容,更多请关注【创想鸟】其它相关文章!

声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。

点点赞赏,手留余香

给TA打赏
共0人
还没有人赞赏,快来当第一个赞赏的人吧!
    编程技术

    css怎么设置字体颜色

    2025-3-10 19:29:59

    编程技术

    css垂直居中的方法有哪些

    2025-3-10 19:30:07

    0 条回复 A文章作者 M管理员
    欢迎您,新朋友,感谢参与互动!
      暂无讨论,说说你的看法吧
    个人中心
    购物车
    优惠劵
    今日签到
    私信列表
    搜索