圆角边框(sublime环境)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<style>
div {
width: 200px;
height: 200px;
border: 1px solid red;
}
div:first-child { /* 结构伪类选择器 选亲兄弟 */
border-radius: 10px; /* 一个数值表示4个角都是相同的 10px 的弧度 */
}
div:nth-child(2) {
/*border-radius: 100px; 取宽度和高度 一半 则会变成一个圆形 */
border-radius: 50%; /* 100px 50% 取宽度和高度 一半 则会变成一个圆形 */
}
div:nth-child(3) {
border-radius: 10px 40px; /* 左上角 和 右下角 是 10px 右上角 左下角 40 对角线 */
}
div:nth-child(4) {
border-radius: 10px 40px 80px; /* 左上角 10 右上角 左下角 40 右下角80 */
}
div:nth-child(5) {
border-radius: 10px 40px 80px 100px; /* 左上角 10 右上角 40 右下角 80 左下角 右下角100 */
}
div:nth-child(6) {
border-radius: 100px;
height: 100px;
}
div:nth-child(7) {
border-radius: 100px 0;
}
</style>
</head>
<body>
<div> 20px</div>
<div> 50% 或者 100px</div>
<div>10px 40px</div>
<div>10px 40px 80px</div>
<div>10px 40px 80px 100px</div>
<div>123</div>
<div><div>
</body>
</html>
打开结果

本文详细介绍了如何使用CSS的border-radius属性来创建不同类型的圆角边框效果,包括简单的圆角、圆形以及复杂的多边形形状。通过具体的代码实例,展示了如何根据不同需求设置边框的弧度,为网页设计提供了丰富的视觉效果。
简单实例认识 border-radius&spm=1001.2101.3001.5002&articleId=107301514&d=1&t=3&u=825f942868a24011947bf54730fca8f2)
2437

被折叠的 条评论
为什么被折叠?



