/* 縮寫:水平半徑 / 垂直半徑 */
border-radius: 2em 1em 4em / 0.5em 3em;
/* 等價於 */
border-top-left-radius: 2em 0.5em;
border-top-right-radius: 1em 3em;
border-bottom-right-radius: 4em 0.5em;
border-bottom-left-radius: 1em 3em;
無 / 時水平垂直半徑相等。四值順序:左上、右上、右下、左下。
.round {
border-radius: 5px; /* 標準 */
-moz-border-radius: 5px; /* Firefox 老版本 */
-webkit-border-radius: 5px; /* WebKit 老版本 */
/* 四角不同半徑 */
border-radius: 5px 4px 3px 2px;
}
寬高相等,半徑 = 寬度/2
#circle {
width: 200px; height: 200px;
background: #a72525;
border-radius: 100px; /* 或 50% */
}
邊框寬度 < 寬度/2
#circle {
width: 200px; height: 200px;
background: #efefef; /* 或 transparent */
border: 3px solid #a72525;
border-radius: 100px;
}
#circle {
width: 200px; height: 200px;
background: transparent;
border: 3px dashed #a72525;
border-radius: 100px;
}
寬 = 高/2,僅左側兩角圓角 = 高度
#semicircle {
width: 100px; height: 200px;
background: #a72525;
border-radius: 200px 0 0 200px; /* 或 100px 0 0 100px 視方向 */
}
寬高相等,單角圓角 = 寬度
#quarter {
width: 200px; height: 200px;
background: #a72525;
border-radius: 200px 0 0 0; /* 左上角 */
}
border-style: dashed 配合單側圓角z-index 控制遮擋position: absolute 疊加 + rgba() 半透明 + z-index 分層border-radius: 50% 製作圓形,自適應容器尺寸clip-path 實現更複雜非矩形裁剪transition: border-radius .3s 可平滑變形will-change: border-radius 或改用 SVG