CSS - border-start-start-radius 属性



CSS 的border-start-start-radius 属性定义元素的块起始内联起始边之间角的圆角半径。此属性是一个逻辑边框半径,这意味着其值取决于元素的书写模式、方向和文本方向。

语法

border-start-start-radius: 0 | length | percentage | initial | inherit;

属性值

描述
0 没有圆角效果。默认值。
长度 使用长度值定义块起始和内联起始角的圆角。
百分比 使用百分比值定义块起始和内联起始角的圆角。
初始 将属性设置为其默认值。
继承 从父元素继承属性。

Explore our latest online courses and learn new skills at your own pace. Enroll and become a certified expert to boost your career.

CSS 边框起始起始半径示例

以下示例使用不同的值说明了border-start-start-radius 属性。

值为零的边框起始起始半径属性

为了在块起始和内联起始角处不产生任何圆角效果,我们可以使用 0。在以下示例中,使用了 0 值。

示例

Open Compiler
<!DOCTYPE html> <html> <head> <style> .rounded-box { padding:20px; width: 150px; height: 150px; border: 3px solid green; border-start-start-radius: 0; } </style> </head> <body> <h2> CSS border-start-start-radius property </h2> <div class="rounded-box"> No rounded corner for block-start and inline-start corner. </div> </body> </html>

使用长度值的边框起始起始半径属性

为了在块起始和内联起始角处产生圆角效果,我们可以使用长度值(例如 10px、20px 30px 等)指定圆角。在以下示例中,使用了长度值。

示例

Open Compiler
<!DOCTYPE html> <html> <head> <style> .boxes { width: 150px; height: 150px; padding: 25px; border: 3px solid red; } .rounded-box1 { border-start-start-radius: 80px; } .rounded-box2 { border-start-start-radius: 80px 80px; } </style> </head> <body> <h2> CSS border-start-start-radius property </h2> <h3> Single Value: 80px (The corner will be a circle) </h3> <p class="boxes rounded-box1"> Rounded corner for block-start and inline-start corner with single value. </p> <h3> Two Values: 80px 80px (The corner will be an ellipse) </h3> <p class="boxes rounded-box2"> Rounded corner for block-start and inline-start corner with two values. </p> </body> </html>

使用百分比值的边框起始起始半径属性

为了在块起始和内联起始角处产生圆角效果,我们可以使用百分比值(例如 10%、20% 30% 等)指定圆角。在以下示例中,使用了百分比值。

示例

Open Compiler
<!DOCTYPE html> <html> <head> <style> .boxes { width: 150px; height: 150px; padding: 25px; border: 3px solid red; } .rounded-box1 { border-start-start-radius: 50%; } .rounded-box2 { border-start-start-radius: 50% 50%; } </style> </head> <body> <h2> CSS border-start-start-radius property </h2> <h3> Single Value: 50% (The corner will be a circle) </h3> <p class="boxes rounded-box1"> Rounded corner for block-start and inline-start corner with single value. </p> <h3> Two Values: 50% 50% (The corner will be an ellipse) </h3> <p class="boxes rounded-box2"> Rounded corner for block-start and inline-start corner with two values. </p> </body> </html>

带方向的边框起始起始半径属性

border-start-start-radius 上下文中,direction 参数决定要圆角的哪个角。在 LTR 方向中,左上角被圆角化,而在 RTL 方向中,右上角被圆角化。LTR 是默认方向。这些在以下示例中显示。

示例

Open Compiler
<!DOCTYPE html> <html> <head> <style> .boxes { width: 150px; height: 150px; padding: 25px; border: 3px solid red; border-start-start-radius: 120px 60px; } .right { direction: ltr; } .left { direction: rtl; } </style> </head> <body> <h2> CSS border-start-start-radius property </h2> <h3> Left-to-Right direction: top left corner is rounded </h3> <p class=" boxes right"> block-start and inline-start rounded corner using direction: ltr </p> <h3> Right-to-Left direction: top right corner is rounded </h3> <p class="boxes left"> block-start and inline-start rounded corner using direction: rtl </p> </body> </html>

带书写模式的边框起始起始半径属性

border-start-start-radius 属性可与writing-mode: vertical-lr 一起使用,它将文本垂直排列,从上到下,从左到右。类似地,使用writing-mode: vertical-rl,它将文本垂直排列,从上到下,从右到左。这些在以下示例中显示。

示例

Open Compiler
<!DOCTYPE html> <html> <head> <style> .rounded-box { width: 150px; height: 150px; padding: 25px; border: 3px solid red; margin: 10px; border-start-start-radius: 30%; } .top-left-lr { writing-mode: vertical-lr; } .top-left-rl { writing-mode: vertical-rl; } </style> </head> <body> <h2> CSS border-start-start-radius property </h2> <h3> Writing mode: vertical-lr </h3> <div class="rounded-box top-left-lr"> block-start and inline-start rounded corner using vertical-lr. </div> <h3> Writing mode: vertical-rl </h3> <div class="rounded-box top-left-rl"> block-start and inline-start rounded corner using vertical-rl. </div> </body> </html>

注意:border-start-start-radius 属性最多可以接受两个值,因此,根据传递的值的数量,将确定角的圆角。

  • 一个值:如果为属性提供一个值,则块起始和内联起始处的角将为圆形。
  • 两个值:如果为属性提供两个值,则块起始和内联起始处的角将为椭圆形。

支持的浏览器

属性 Chrome Edge Firefox Safari Opera
border-start-start-radius 89.0 89.0 66.0 15.0 75.0
css_properties_reference.htm
广告