原理
一张图说明问题:
其实就是我们认为指定圆的半径,圆和矩形相切的时候就是最终的效果了。
语法
border-radius:length; |
---|
- 参数可以为数值或百分比的形式
演示
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>圆角矩形</title>
<style>
div{
background-color: plum;
}
.radio{
width: 200px;
height: 200px;
border-radius: 100px;
}
.radioJiao{
width: 200px;
height: 100px;
margin: 20px;
margin-left: 0px;
border-radius: 50px;
}
.bord{
width: 200px;
height: 200px;
border-radius: 30px 10px;
}
</style>
</head>
<body>
<div class="radio"></div>
<div class="radioJiao"></div>
<div class="bord"></div>
</body>
</html>