还有一点,偏移量可以使正,也可以是负值。
简单的不用js就行
<!DOCTYPE HTML><html>
<head>
<meta charset= "utf8">
<title>untitled</title>
<link rel = "stylesheet" type = "text/css" href = "">
<style type = "text/css">
*{
margin: 0px
padding: 0px
}
#a{
position: absolute
width: 50px
height: 50px
background-color: #f3e9e0
border-radius: 50%
left: 400px
top: 200px
}
#a div{
position: absolute
width: 50px
height: 50px
border-radius: 50%
transition: all 0.5s
left: 0px
top: 0px
}
#a :nth-child(1){
background-color: #c1d4ed
}
#a :nth-child(2){
background-color: #7d6e69
}
#a :nth-child(3){
background-color: #dad6d5
}
#a :nth-child(4){
background-color: #caaa9d
}
#a :nth-child(5){
background-color: #6bdeff
}
#a:hover :nth-child(1){
left: 150px
top: -150px
}
#a:hover :nth-child(2){
left: 150px
top: 150px
}
#a:hover :nth-child(3){
left: 300px
top: -150px
}
#a:hover :nth-child(4){
left: 300px
top: 150px
}
#a:hover :nth-child(5){
left: 450px
top: 0px
}
</style>
</head>
<body>
<div id = 'a'>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
</div>
</body>
</html>
鼠标伸到球上 自动扩散移动
box-shadow: 0px 1px 4px rgba(0, 0, 0, 0.5) inset
CSS3边框阴影效果,对应解释,阴影向右偏移0PX ,向下平移1PX, 阴影扩散4PX,阴影颜色 带0.5度透明的黑色,inset为指定阴影效果为向内扩散,不指定则默认向外部扩散。
-moz-box-shadow 为了兼容火狐浏览器
-webkit-box-shadow 兼容webkit内核浏览器,如谷歌chrome
效果图: