border-radius 可以用來給元素加上圓角邊框,靈活調整各個角的半徑還能拼出多種形狀。
例如:
border-radius:20px; /* 所有角都使用半徑 20px 的圓角 */

把寬度(width)與高度(height)設為一致(即正方形),並把四個圓角半徑都設為其值的一半:
.circle{ height:100px; width:100px; background:#9da; border-radius:50px;/* 四個圓角都設為寬高的一半 */ }

把高度設為寬度的一半,並只把左上、右上兩角的半徑設為與元素高度一致(大於也可以):
.circle1{ height:50px; /* 是 width 的一半 */ width:100px; background:#9da; border-radius: 50px 50px 0 0; /* 半徑至少設為 height 的值 */ }

同理可得下半圓、左半圓、右半圓,只需修改對應角的半徑值即可。