代码:
<!DOCTYPE html>
<html>
<head>
<title>sample</title>
<meta charset="utf-8">
<style type="text/css">
._box{
width: 300px;
height: 100px;
position: absolute;
top: 100px;
left: 50%;
background-color: #eee;
box-shadow: 1px 1px 2px #999;
}
._box p{
text-align: center;
font-size: 20px;
font-family: "Microsoft Yahei";
line-height: 50px;
color: #aaa;
transition: all ease .5s;
}
._box{
transition: all ease .5s;
}
._box:hover {
width: 400px;
border-radius: 3px 50px 50px 3px;
background-color: orange;
box-shadow: 0px 0px 0px #444;
}
._box:hover p{
color: #fff;
}
._box1{
width: 300px;
height: 100px;
position: absolute;
top: 210px;
left: 50%;
background-color: #eee;
box-shadow: 1px 1px 2px #999;
}
._box1 p{
text-align: center;
font-size: 20px;
font-family: "Microsoft Yahei";
line-height: 50px;
color: #aaa;
transition: all ease .5s;
}
._box1{
transition: all ease .5s;
}
._box1:hover {
width: 400px;
border-radius: 3px 50px 50px 3px;
background-color: #149971;
box-shadow: 0px 0px 0px #444;
}
._box1:hover p{
color: #fff;
}
._box2{
width: 300px;
height: 100px;
position: absolute;
top: 320px;
left: 50%;
background-color: #eee;
box-shadow: 1px 1px 2px #999;
}
._box2 p{
text-align: center;
font-size: 20px;
font-family: "Microsoft Yahei";
line-height: 50px;
color: #aaa;
transition: all ease .5s;
}
._box2{
transition: all ease .5s;
}
._box2:hover {
width: 400px;
border-radius: 3px 50px 50px 3px;
background-color: #1571fa;
box-shadow: 0px 0px 0px #444;
}
._box2:hover p{
color: #fff;
}
</style>
</head>
<body>
<div class="c1">
<div class="jt">
</div>
<div class="_box" >
<p >渐变方块</p>
</div>
</div>
<div class="c2">
<div class="jt1">
</div>
<div class="_box1" >
<p >渐变方块</p>
</div>
</div>
<div class="c3">
<div class="jt2">
</div>
<div class="_box2" >
<p >渐变方块</p>
</div>
</div>
</body>
</html>
效果图:
(自己复制粘贴后看看吧)