css设置椭 圆 的方法:1、给元素添加“{width: 宽 度值;h ei ght:高度值;}”样式,将元素设置为矩形;2、给矩形元素添加“{border-radius:100%;}”圆角样式将其设置为椭圆即可。
本教程操作环境:windows7系统、CSS3 && HT ML 5版、Dell G3 电 脑。
css设置椭圆的方法
1、我们可以先给div元素创建成矩形,然后使用css的border-radius属性类设置矩形的圆角,就可以得到椭圆,代码如下:
先创建一个矩形
<!DOCTY PE html> <html> <head> < ;m eta charset="UTF-8"> <t IT le>css 制作 椭圆</title> <style> .ellipse{ width: 200px; height: 100px; background-color: red ; } </style> </head> <body> <div class="ellipse"></div> </body> </html>
输出结果:
2、然后通过border-radius属性来设置圆角,在ellipse属性里添加:border-radius:100%; 即可设置椭圆。
为了兼容各种浏览器我们在这里还要添加
-o-border-radius:100%; -ms-border-radius:100%; -moz-border-radius:100%; - webkit -border-radius:100%;
代码如下:
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>css制作椭圆</title> <style> .ellipse{ width: 200px; height: 100px; background-color: red; border-radius:100%; -o-border-radius:100%; -ms-border-radius:100%; -moz-border-radius:100%; -webkit-border-radius:100%; } </style> </head> <body> <div class="ellipse"></div> </body> </html>
输出结果:
更多编程相关知识,请访问:编程视频!!
以上就是css 怎样 设置椭圆的详细内容,更多请关注其它相关 文章 !
总结
以上是 为你收集整理的 css怎样设置椭圆 全部内容,希望文章能够帮你解决 css怎样设置椭圆 所遇到的问题。
如果觉得 网站内容还不错, 推荐好友。
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://haodehen.cn/did200264