整理 border-radius(圓角)的幾個重點:
border-radius: 長度;
在各瀏覽器中的支援情況(私有前綴時期):
-moz-border-radius:2px;-webkit-border-radius:2px;border-radius:2px;圓角位置可以隨意指定:左上、右上、左下、右下。各瀏覽器的屬性名稱寫法如下:
/* 左上 */ -moz-border-radius-topleft / -webkit-border-top-left-radius / border-top-left-radius /* 右上 */ -moz-border-radius-topright / -webkit-border-top-right-radius / border-top-right-radius /* 左下 */ -moz-border-radius-bottomleft / -webkit-border-bottom-left-radius / border-bottom-left-radius /* 右下 */ -moz-border-radius-bottomright / -webkit-border-bottom-right-radius / border-bottom-right-radius
border-radius 還有更多變化,例如用斜線分隔水平與垂直半徑來做出橢圓圓角、用百分比數值、或一次設定多組值。Firefox、Webkit 核心的 Safari/Chrome 與 Opera 在這些進階寫法上有些差異,可以參考:
現代補充:這些前綴早已可以丟掉。今天只需要寫 border-radius(以及四個方向的 border-top-left-radius 等),所有現代瀏覽器都支援;若需要相容舊版 IE,則仍可回到「用圖片做圓角」的傳統做法。