border-end-start-radius

Baseline 已廣泛支援

此功能已成熟,並可在多種裝置和瀏覽器版本上執行。自 2021 年 9 月起,所有瀏覽器均已支援此功能。

border-end-start-radius CSS 屬性定義了元素上的邏輯邊框半徑,它根據元素的 writing-modedirectiontext-orientation 對映到物理邊框半徑。這在構建樣式時非常有用,無論 文字方向書寫模式 如何都能正常工作。

試一試

border-end-start-radius: 80px 80px;
border-end-start-radius: 250px 100px;
direction: rtl;
border-end-start-radius: 50%;
writing-mode: vertical-lr;
border-end-start-radius: 50%;
writing-mode: vertical-rl;
<section class="default-example" id="default-example">
  <div class="transition-all" id="example-element">
    This is a box with a bottom left rounded corner.
  </div>
</section>
#example-element {
  width: 80%;
  height: 80%;
  display: flex;
  justify-content: center;
  flex-direction: column;
  background-color: #5b6dcd;
  color: white;
  padding: 10px;
}

此屬性影響元素塊級末端和行內起始側之間的角。例如,在 horizontal-tb 書寫模式且 ltr 方向下,它對應於 border-bottom-left-radius 屬性。

語法

css
/* <length> values */
/* With one value the corner will be a circle */
border-end-start-radius: 10px;
border-end-start-radius: 1em;

/* With two values the corner will be an ellipse */
border-end-start-radius: 1em 2em;

/* Global values */
border-end-start-radius: inherit;
border-end-start-radius: initial;
border-end-start-radius: revert;
border-end-start-radius: revert-layer;
border-end-start-radius: unset;

<length-percentage>

表示圓的半徑或橢圓的半長軸和半短軸的大小。作為絕對長度,它可以表示為 CSS <length> 資料型別允許的任何單位。百分比值中,水平軸的百分比值參照框的寬度,垂直軸的百分比值參照框的高度。負值無效。

正式定義

初始值0
應用於所有元素;但當border-collapsecollapse時,使用者代理不要求應用於tableinline-table元素。目前,內部表格元素的行為未定義。它也適用於::first-letter
繼承性
百分比參考邊框框的相應維度
計算值兩個絕對 <length><percentage>
動畫型別一個長度百分比或 calc();

正式語法

border-end-start-radius = 
<length-percentage [0,∞]>{1,2}

<length-percentage> =
<length> |
<percentage>

示例

帶有垂直文字的邊框半徑

HTML

html
<div>
  <p class="exampleText">Example</p>
</div>

CSS

css
div {
  background-color: rebeccapurple;
  width: 120px;
  height: 120px;
  border-end-start-radius: 10px;
}

.exampleText {
  writing-mode: vertical-rl;
  padding: 10px;
  background-color: white;
  border-end-start-radius: 10px;
}

結果

規範

規範
CSS 邏輯屬性和值第 1 級
# border-radius-properties

瀏覽器相容性

另見