温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

css怎样制作圆

发布时间:2021-04-09 09:55:53 来源:亿速云 阅读:210 作者:小新 栏目:web开发

小编给大家分享一下css怎样制作圆,相信大部分人都还不怎么了解,因此分享这篇文章给大家参考一下,希望大家阅读完这篇文章后大有收获,下面让我们一起去了解一下吧!

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

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

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

.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画圆:

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

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

css怎样制作圆

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

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

css怎样制作圆

同理虚线圆代码:

#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.半圆和四分之一圆代码:

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

css怎样制作圆

<!doctype html>
<html>
 <head>
  <meta charset="UTF-8">
  <meta name="Generator" content="EditPlus®">
  <meta name="Author" content="">
  <meta name="Keywords" content="">
  <meta name="Description" content="">
  <title>Document</title>
  <style type="text/css">
      #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 */
     }

  </style>
 </head>
 <body>
  <div id="quartercircle">
  <div>点选</div>
  </div>
 </body>
</html>

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怎样制作圆”这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注亿速云行业资讯频道!

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI