CSS border-bottom-right-radius 属性 详解
css3基础 2022-07-14 15:56:0010小码哥的IT人生shichen
CSS border-bottom-right-radius 属性
实例
向 div 元素的右下角添加圆角边框:
div { border:2px solid; border-bottom-right-radius:2em; }
完整实例【亲自试一试】:
<!DOCTYPE html> <html> <head> <style> div { border:2px solid; padding:10px; background:#dddddd; border-bottom-right-radius:2em; } </style> </head> <body> <div>border-bottom-right-radius 属性允许您向右下角添加圆角边框。</div> </body> </html>
可以使用本站在线JavaScript测试工具测试上述代码运行效果:http://www.phpcodeweb.com/runjs.html
CSS 语法
border-bottom-right-radius: length|% [length|%];
注释:border-bottom-right-radius 属性的长度值和百分比值定义四分之一椭圆(定义外部边框边缘的边角形状)的半径(radii)。第一个值是水平半径,第二个值是垂直半径。如果省略第二个值,则复制第一个值。如果长度为零,则边角为方形,而不是圆形。水平半径的百分比值参考边框盒的宽度,而垂直半径的百分比值参考边框盒的高度。
属性值
值 | 描述 | 测试 |
---|---|---|
length | 定义右下角的形状。 | 测试 |
% | 以百分比值定义右下角的形状。 | 测试 |
技术细节
默认值: | 0 |
---|---|
继承性: | no |
版本: | CSS3 |
JavaScript 语法: | object.style.borderBottomRightRadius="5px" |
浏览器支持
表格中的数字注明了完全支持该属性的首个浏览器版本。
Chrome | IE / Edge | Firefox | Safari | Opera |
---|---|---|---|---|
5.0 4.0 -webkit- |
9.0 | 4.0 3.0 -moz- |
5.0 3.1 -webkit- |
10.5 |
完整实例1:
<!DOCTYPE html> <html lang="zh_CN"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Demo</title> <style> ul, li{margin:0;padding:0;} li{list-style:none;} div#wrapper{width: 960px;margin: 0 auto;padding: 0;text-align: left;border:1px solid #c5c5c5;} #SelArea{float: left;width: 480px;margin:0;padding:0;border: 0px solid #c5c5c5;} #SelArea p{margin:20px; } #result{float: left;width: 478px;margin:0;padding:0;border: 0px solid #c5c5c5;} #CodeArea{width: 440px;margin:0;margin-left: 10px;margin-bottom:10px;padding: 5px;font-family: courier new;color: #222222;background-color: #f1f1f1;border: 1px solid #c3c3c3;} #DemoArea{width: 450px;height: 280px;margin:0;padding:0;margin-left: 10px;background-color: #ffffff;border: 1px solid #c3c3c3;} div#DemoArea { border-bottom-right-radius:100px; } </style> <body> <div id="wrapper"> <div id="SelArea"> <h2>CSS 属性:</h2> <h3>border-bottom-right-radius:</h3> <form action="javascript:return false;"> <ul> <input type="hidden" id="PreSelectedValue" value="" /> <li><input autocomplete="off" type="radio" name="rpos" onClick="test_demo(this)" id="value_1" value="100px" checked="checked" />100px</li> <li><input autocomplete="off" type="radio" name="rpos" onClick="test_demo(this)" id="value_2" value="50px" />50px</li> <li><input autocomplete="off" type="radio" name="rpos" onClick="test_demo(this)" id="value_3" value="10px" />10px</li> <li><input autocomplete="off" type="radio" name="rpos" onClick="test_demo(this)" id="value_4" value="5px" />5px</li> <li><input autocomplete="off" type="radio" name="rpos" onClick="test_demo(this)" id="value_5" value="3px" />3px</li> <li><input autocomplete="off" type="radio" name="rpos" onClick="test_demo(this)" id="value_6" value="10%" />10%</li> <li><input autocomplete="off" type="radio" name="rpos" onClick="test_demo(this)" id="value_7" value="50%" />50%</li> <li><input autocomplete="off" type="radio" name="rpos" onClick="test_demo(this)" id="value_8" value="100%" />100%</li> </ul> </form> </div> <div id="result"> <h2>结果:</h2> <div id="DemoArea"> </div> <h2>CSS 代码:</h2> <pre id="CodeArea"> div#DemoArea { border-bottom-right-radius:<span id="CodeValue">100px</span>; } </pre> </div> <script> function test_demo_val(strValue) { var strId="DemoArea" document.getElementById(strId).style.borderBottomRightRadius=strValue; document.getElementById("CodeValue").innerHTML=strValue; } function tiy_onload(){ var PreVal="" PreVal=document.getElementById("PreSelectedValue").value if (PreVal!=""){ test_demo_val(PreVal) var x=document.getElementsByTagName("input") var l=x.length for (i=0;i<l;i++){ if (x[i].value==PreVal){ x[i].checked=true } } } } function test_demo(obj){ test_demo_val(obj.value) } tiy_onload() </script> </body> </html>
可以使用本站在线JavaScript测试工具测试上述代码运行效果:http://www.phpcodeweb.com/runjs.html
完整实例2:
<!DOCTYPE html> <html lang="zh_CN"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Demo</title> <style> ul, li{margin:0;padding:0;} li{list-style:none;} div#wrapper{width: 960px;margin: 0 auto;padding: 0;text-align: left;border:1px solid #c5c5c5;} #SelArea{float: left;width: 480px;margin:0;padding:0;border: 0px solid #c5c5c5;} #SelArea p{margin:20px; } #result{float: left;width: 478px;margin:0;padding:0;border: 0px solid #c5c5c5;} #CodeArea{width: 440px;margin:0;margin-left: 10px;margin-bottom:10px;padding: 5px;font-family: courier new;color: #222222;background-color: #f1f1f1;border: 1px solid #c3c3c3;} #DemoArea{width: 450px;height: 280px;margin:0;padding:0;margin-left: 10px;background-color: #ffffff;border: 1px solid #c3c3c3;} div#DemoArea { border-bottom-right-radius:100px; } </style> <body> <div id="wrapper"> <div id="SelArea"> <h2>CSS 属性:</h2> <h3>border-bottom-right-radius:</h3> <form action="javascript:return false;"> <ul> <input type="hidden" id="PreSelectedValue" value="10%" /> <li><input autocomplete="off" type="radio" name="rpos" onClick="test_demo(this)" id="value_1" value="100px" />100px</li> <li><input autocomplete="off" type="radio" name="rpos" onClick="test_demo(this)" id="value_2" value="50px" />50px</li> <li><input autocomplete="off" type="radio" name="rpos" onClick="test_demo(this)" id="value_3" value="10px" />10px</li> <li><input autocomplete="off" type="radio" name="rpos" onClick="test_demo(this)" id="value_4" value="5px" />5px</li> <li><input autocomplete="off" type="radio" name="rpos" onClick="test_demo(this)" id="value_5" value="3px" />3px</li> <li><input autocomplete="off" type="radio" name="rpos" onClick="test_demo(this)" id="value_6" value="10%" />10%</li> <li><input autocomplete="off" type="radio" name="rpos" onClick="test_demo(this)" id="value_7" value="50%" />50%</li> <li><input autocomplete="off" type="radio" name="rpos" onClick="test_demo(this)" id="value_8" value="100%" />100%</li> </ul> </form> </div> <div id="result"> <h2>结果:</h2> <div id="DemoArea"> </div> <h2>CSS 代码:</h2> <pre id="CodeArea"> div#DemoArea { border-bottom-right-radius:<span id="CodeValue">100px</span>; } </pre> </div> <script> function test_demo_val(strValue) { var strId="DemoArea" document.getElementById(strId).style.borderBottomRightRadius=strValue; document.getElementById("CodeValue").innerHTML=strValue; } function tiy_onload(){ var PreVal="" PreVal=document.getElementById("PreSelectedValue").value if (PreVal!=""){ test_demo_val(PreVal) var x=document.getElementsByTagName("input") var l=x.length for (i=0;i<l;i++){ if (x[i].value==PreVal){ x[i].checked=true } } } } function test_demo(obj){ test_demo_val(obj.value) } tiy_onload() </script> </body> </html>
可以使用本站在线JavaScript测试工具测试上述代码运行效果:http://www.phpcodeweb.com/runjs.html