- 구문 :
border-radius:length;
상기 식에서 각각의 값은 값이나 될 수 백분율 형태.
팁 : 사각형이 원하게합시다
border-radius: 50%;
- 도는 높이와 폭의 절반이 될 것이다 백분율로 표현 된 비율을 사용하지 않는 효과 상기 직사각형 반올림.
- 그리고 여기에 우리는 매우 충분 사각형의 절반을 사용합니다. 정확한 단위.
demo
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
div {
width: 200px;
height: 200px;
background-color: pink;
/*border-radius: 100px;*/
border-radius: 50%;
}
p {
width: 100px;
height: 20px;
background-color: red;
font-size: 12px;
color: #fff;
text-align: center;
line-height: 20px;
border-radius: 10px;
}
</style>
</head>
<body>
<div> </div>
<p> 特价 免费送 </p>
</body>
</html>
我的demo
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
div {
width: 200px;
height: 200px;
background-color: pink;
border-radius: 50%;
}
p {
width: 120px;
height: 30px;
/* line-height: 30px; */ /* 不生效,会被下面的font: 900 16px "arial" 覆盖掉, */
text-align: center;
background-color: lightskyblue;
/* 要么写成 font: 900 16px/30px "arial",要么在下面加一行 line-height: 30px; */
font: 900 16px "arial";
line-height: 30px;
border-radius: 15px;
color: white;
}
</style>
</head>
<body>
<div> </div>
<p> 特价 免费送 </p>
</body>
</html>