<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>圆角与盒子阴影</title>
<style>
div {
width: 200px;
height: 160px;
text-align: center;
background-color: orange;
margin: 20px;
border-radius: 20px; /*圆角半径最大即为50%*/
/* border-radius: 10px 20px 40px 80px; 代表顺序从左上角开始,顺时针旋转,其余规则与padding属性相同 */
/* border-radius: 10px 20px 40px; */
/* border-radius: 10px 60px; */
/* width: 400px;
border-radius: 80px; 胶囊型盒子,圆角半径为盒子高度的一般 */
/* 四个参数分别为横向偏移量,竖向偏移量,
模糊半径(竖直越大越模糊),阴影半径(数值越大阴影越大)
想要设置内阴影需要另加inset关键字
rgba去色最后一个参数控制透明度,数值越大颜色越浓 */
box-shadow: 10px 10px 10px 1px rgba(0, 0, 0, 0.7);
}
img {
width: 100%;
height: 100%;
object-fit: cover; /*保持图片比例的同时填满容器(避免变形)*/
}
</style>
</head>
<body>
<div>Hello World!</div>
<!-- 创建头像组件 -->
<div style="width: 200px; height: 200px; border-radius: 50%; overflow: hidden;">
<img src="./Img/Sana.jpg" alt="Picture of Sana" title="Sana">
</div>
</body>
</html>
CSS盒子模型圆角与阴影
最新推荐文章于 2025-12-27 19:25:02 发布
1555

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



