欢迎您光临自学哈网,只为分享网络知识教程,供大家学习参考!

「自学哈网」CSS3圆角属性(border-radius)的写法,应该怎么写?

作者 : 自学哈 本文共1273个字,预计阅读时间需要4分钟 2023-07-26 共69人阅读
也想出现在这里? 联系我们

CSS3圆角属性(border-radius)的写法,应该怎么写?

 

前缀

  • -moz(例如 -moz-border-radius)用于Firefox
  • -webkit(例如:-webkit-border-radius)用于Safari和Chrome。

 

例1

<div id="round"></div>
#round {
    padding:10px; width:300px; height:50px;
    border: 5px solid #dedede;
    -moz-border-radius: 15px;      /* Gecko browsers */
    -webkit-border-radius: 15px;   /* Webkit browsers */
    border-radius:15px;            /* W3C syntax */
}

效果:
CSS3圆角属性(border-radius)的写法,应该怎么写?

 

例2:无边框

<div id="round"></div>  
#round {
    padding:10px; width:300px; height:50px;
    background:#FC9; 
    -moz-border-radius: 15px;
    -webkit-border-radius: 15px;
    border-radius:15px;
}

效果:
CSS3圆角属性(border-radius)的写法,应该怎么写?

 

书写顺序

/* Gecko browsers */
-moz-border-radius: 5px; 
/* Webkit browsers */
-webkit-border-radius: 5px; 
/* W3C syntax - likely to be standard so use for future proofing */
border-radius:10px;

 

其它

支持上、右、下、左

border-radius:5px 15px 20px 25px;

支持拆分书写

/* Gecko browsers */
-moz-border-radius-topleft: 20px;
-moz-border-radius-topright: 0;
-moz-border-radius-bottomleft: 0;
-moz-border-radius-bottomright: 20px;
 
/* Webkit browsers */
-webkit-border-top-left-radius: 20px;
-webkit-border-top-right-radius: 0;
-webkit-border-bottom-left-radius: 0;
-webkit-border-bottom-right-radius: 20px;
 
/* W3C syntax */
border-top-left-radius: 20px;
border-top-right-radius: 0;
border-bottom-right-radius: 0;
border-bottom-left-radius:  20px;

 

支持性

浏览器 支持性
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 ×

 

本站声明:
本站所有资源来源于网络,分享目的仅供大家学习和交流!如若本站内容侵犯了原著者的合法权益,可联系邮箱976157886@qq.com进行删除。
自学哈专注于免费提供最新的分享知识、网络教程、网络技术的资源分享平台,好资源不私藏,大家一起分享!

自学哈网 » 「自学哈网」CSS3圆角属性(border-radius)的写法,应该怎么写?
也想出现在这里? 联系我们
© 2022 Theme by - 自学哈网 & WordPress Theme. All rights reserved 浙ICP备2022016594号