实例代码:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
div{
width:250px;
height:250px;
float:left;
}
.corners1{
border:1px solid red;
border-radius:14px;
background-color:green;
width:200px;
height:150px;
padding:12px;
}
.corners2{
border:2px solid blue;
border-radius:14px;
width:200px;
height:150px;
padding:12px;
}
.corners3{
border-radius:14px;
background-image:url(img/aa.jpg);
width:200px;
height:150px;
padding:12px;
}
</style>
</head>
<body>
<h1>border-radius 属性</h1>
<div >
<p>拥有指定背景颜色的元素的圆角</p>
<p class="corners1">Rounded corners!</p>
</div>
<div>
<p>带边框元素的圆角:</p>
<p class="corners2">Rounded corners!</p>
</div>
<div>
<p>拥有背景图片的元素的圆角:</p>
<p class="corners3">Rounded corners!</p>
</div>
</body>
</html>
运行效果:
评论