css鼠标移上背景滑动显示
2014-12-03 13:48
573 查看
Demo下载 效果如图:
css:
a {
display: inline-block;
color: #fff;
font-size: 12px;
text-decoration: none;
padding: 0 5px;
height: 24px;
text-align: center;
line-height: 24px;
position: relative;
color: #000;
}
a>span {
display: inline-block;
width: 100%;
height: 100%;
position: relative;
top: 0;
left: 0;
z-index: 2;
}
a:hover>span {
color: #fff;
-moz-transition: all 0.15s ease-in;
-webkit-transition: all 0.15s ease-in;
-o-transition: all 0.15s ease-in;
transition: all 0.15s ease-in;
}
a:before {
content: "";
width: 100%;
height: 24px;
background: #f5485c;
position: absolute;
top: -24px;
left: 0;
z-index: 1;
opacity: 0;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
-moz-transition: all 0.15s ease-in;
-webkit-transition: all 0.15s ease-in;
-o-transition: all 0.15s ease-in;
transition: all 0.15s ease-in;
}
a:hover:before {
opacity: 1;
top: 0;
}
html:
<a href="#"><span>哈哈哈</span></a>
css:
a {
display: inline-block;
color: #fff;
font-size: 12px;
text-decoration: none;
padding: 0 5px;
height: 24px;
text-align: center;
line-height: 24px;
position: relative;
color: #000;
}
a>span {
display: inline-block;
width: 100%;
height: 100%;
position: relative;
top: 0;
left: 0;
z-index: 2;
}
a:hover>span {
color: #fff;
-moz-transition: all 0.15s ease-in;
-webkit-transition: all 0.15s ease-in;
-o-transition: all 0.15s ease-in;
transition: all 0.15s ease-in;
}
a:before {
content: "";
width: 100%;
height: 24px;
background: #f5485c;
position: absolute;
top: -24px;
left: 0;
z-index: 1;
opacity: 0;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
-moz-transition: all 0.15s ease-in;
-webkit-transition: all 0.15s ease-in;
-o-transition: all 0.15s ease-in;
transition: all 0.15s ease-in;
}
a:hover:before {
opacity: 1;
top: 0;
}
html:
<a href="#"><span>哈哈哈</span></a>
相关文章推荐
- 鼠标覆盖行高亮显示 奇偶行背景颜色不同 css+jquery Table
- CSS鼠标滑动显示标题全部移开显示几个字符
- IE、火狐浏览器鼠标滑动事件改变背景图片和改变不同显示信息
- css实现鼠标移入滑动显示功能
- 用CSS改变鼠标显示
- css javascript滑动文本选项卡显示
- DIV+CSS实现的拖动+隐藏/显示效果+背景变暗
- 用css改变鼠标显示
- 鼠标经过背景变色,CSSJavascript实现表格背景变色
- [css特效]A标记的经典效果:鼠标放到A的整行上,背景变色(鼠标没在文字上)
- css打造经典鼠标触发显示选项
- css javascript滑动文本选项卡显示
- css改变鼠标显示形状代码
- [转]外部css文件中的 BACKGROUND-IMAGE: url(..\image.gif)指定的背景图像无法显示,谁有好主意?
- CSS打造经典鼠标触发显示选项
- css javascript滑动文本选项卡显示
- div+css实现鼠标放上去,背景跟图片都会变化。
- 推荐css打造经典鼠标触发显示选项
- 超强推荐CSS打造经典鼠标触发显示选项
- CSS打造经典鼠标触发显示选项