百变鹏仔-专注前端行业精选
利用css简单实现一个跑马灯效果
作者:鹏仔先生 日期:2020-06-01 16:46:21 浏览:3103 分类:CSS

<style type="text/css">
div,body,input,textarea,a,select,h1,h2,h3,h4,h5,h6,span,p,ul,ol,li,dl,dd,dt,form,table,span,img{
margin:0;
padding:0;
}
.box{
width: 350px;
height: 150px;
border: 10px solid rgba(29,6,253,1);
margin: 30px;
text-align: center;
transition: all 3s;
overflow: hidden;
position: relative;
}
.box a{
display: block;
text-decoration: none;
color: black;
font-weight: bold;
font-size: 30px;
line-height: 150px;
}
.box:hover{
border: 10px solid rgba(29,6,253,0);
}
.box .one:nth-child(1){
width: 350px;
height: 10px;
background: pink;
position: absolute;
top: 0;
left: -350px;
}
.box .one:nth-child(2){
width: 350px;
height: 10px;
background: pink;
position: absolute;
bottom: 0;
right: -350px;
}
.box .one:nth-child(3){
width: 10px;
height: 160px;
background: pink;
position: absolute;
bottom: -160px;
left: 0;
}
.box .one:nth-child(4){
width: 10px;
height: 160px;
background: pink;
position: absolute;
top: -160px;
right: 0;
}
.box:hover .one:nth-child(1){
transform: translateX(350px);
transition: all 2s;
}
.box:hover .one:nth-child(2){
transform: translateX(-350px);
transition: all 2s;
}
.box:hover .one:nth-child(3){
transform: translateY(-160px);
transition: all 3s;
}
.box:hover .one:nth-child(4){
transform: translateY(160px);
transition: all 3s;
}
</style><div class="box"> <div class="one"></div> <div class="one"></div> <div class="one"></div> <div class="one"></div> <a href="#">鹏仔先生</a> </div>
猜你还喜欢
- 09-26 vue中实现1小时不操作则退出登录功能
- 05-14 uniapp微信小程序获取微信步数,微信小程序获取微信步数完整版
- 04-24 简单实现文字两端对齐
- 04-24 检测图片URL是否失效
- 04-24 elemetui中el-date-picker限制开始结束日期只能选择当月
- 04-24 iview中DatePicker时间段选择限制开始结束日期只能选择当月
- 03-24 vue h5实现车牌号输入框
- 11-01 vue中实现代码高亮
- 08-09 vue动态修改网站的icon图标
- 07-08 VUE中ECharts提示框tooltip自动切换
- 07-03 网页中生成微信小程序二维码
- 06-28 vue实现表格自动滚动功能 vue-seamless-scroll
取消回复欢迎 你 发表评论:
- 搜索
- 随机tag








