1、圆角:
<style>
div{
width: 100px;
height: 100px;
border: 1px solid #000;
position: absolute;
left: calc(50% - 50px);
top: calc(50% - 50px);
/* border-radius */
border-radius: 10px 20px 30px 40px;
/* 每个角的写法: */
border-top-left-radius: 10px;
border-top-right-radius:20px;
border-bottom-right-radius:30px;
border-bottom-left-radius:40px;
border-radius: 50%;/* 正圆 */
/* 第三种写法: */
border-radius: 10px 20px 30px 40px / 10px 20px 30px 40px;
/* 左/上,右/上,水平方向 */
}
</style>
</head>
<body>
<div></div>
</body>
2、阴影:
<style>
body{
background-color:#000;
}
div{
position: absolute;
left: calc(50% - 50px);
top: calc(50% - 50px);
width: 100px;
height: 100px;
background-color: transparent;
border: 1px solid #fff;
/* 外阴影: */
/* box-shadow: 0px 0px 0px 0px #0ff;可以负值 */
/* 第一个水平偏移量,第二个垂直偏移量,第四个传播距离 */
/* 第三个参数:基于边框向两侧同时向外展开模糊,越大越虚:模糊值 */
/* 内阴影:向边框内 */
box-shadow: inset 0px 0px 1px 0px #fff,
3px 0px 10px #f0f,
0px -3px 10px #0ff,
0px 3px 10px #ff0;
}
</style>
</head>
<body>
<div></div>
</body>
3、圆形阴影实例:
阴影在文字的下面,在背景颜色的上面
<style>
*{
margin: 0px;
padding: 0px;
}
body{
background-color: #000;
}
div{
position: absolute;
left: calc(50% - 150px);
top: calc(50% - 150px);
width: 300px;
height: 300px;
border: 1px solid #fff;
border-radius: 50%;
box-shadow: inset 0px 0px 50px #fff,
inset 10px 0px 80px #f0f,
inset -10px 0px 80px #0ff,
inset 10px 0px 300px #f0f,
inset -10px 0px 300px #0ff,
0px 0px 50px #fff,
-10px 0px 80px #f0f,
10px 0px 80px #0ff;
}
</style>
</head>
<body>
<div></div>
</body>
4、小太阳实例
<style>
*{
margin: 0px;
padding: 0px;
}
body{
background-color: #000;
}
div{
position: absolute;
left: calc(50% - 25px);
top: calc(50% - 25px);
width: 50px;
height: 50px;
background-color: #fff;
border-radius: 50%;
box-shadow: 0px 0px 100px 50px #fff,
0px 0px 250px 125px #ff0;
}
</style>
</head>
<body>
<div></div>
</body>
5、过渡小方块
<style>
div{
position: absolute;
border-radius: 5px;
left: calc(50% - 50px);
top:calc(50% - 50px);
width: 100px;
height: 100px;
background-color: #fff;
box-shadow: 0px 1px 2px rgba(0,0,0, .1);
}
div::after{
content: "";
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
border-radius: 5px;
box-shadow: 0px 5px 15px rgba(0,0,0,0.3);
opacity: 0;
transition: all .6s;
}
div:hover{
transform:scale(1.25,1.25);
}
div:hover::after{
opacity: 1;
}
</style>
</head>
<body>
<div></div>
</body>