CSS效果:跑马灯按钮
HTML代码
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="style.css">
<title>Document</title>
</head>
<body>
<a href="#">
<span></span>
<span id="1"></span>
<span></span>
<span id="2"></span>
Button
</a>
</body>
</html>
CSS代码
body{
margin:;
padding:;
background:#2f3640;
}
a{
position: absolute;
top:50%;
left:50%;
transform: translate(-50%,-50%);
color:#1670f0;
font-size:60px;
letter-spacing: 2px;
text-transform: uppercase;
text-decoration: none;
box-shadow: 0 40px 100px rgba(0, 0, 0, .5);
padding:30px;
overflow: hidden;
}
a::before{
content: "";
position: absolute;
top:2px;
left:2px;
bottom:2px;
width:50%;
background:rgba(255, 255, 255, .05)
}
a span:nth-child(1){
position: absolute;
top:;
left:;
width:100%;
height:4px;
background:linear-gradient(to right,#2f3640,#1779ff);
animation: animate1 1s linear infinite;
}
@keyframes animate1{
0%{
transform: translateX(-100%);
}
100%{
transform: translateX(100%);
}
}
a span:nth-child(2){
position: absolute;
top:;
right:;
width:4px;
height:100%;
background:linear-gradient(to bottom,#2f3640,#1779ff);
animation: animate2 1s linear infinite;
animation-delay: 0.5s;
}
@keyframes animate2{
0%{
transform: translateY(-100%);
}
100%{
transform: translateY(100%);
}
}
a span:nth-child(3){
position: absolute;
bottom:;
right:;
width:100%;
height:4px;
background:linear-gradient(to left,#2f3640,#1779ff);
animation: animate3 1s linear infinite;
}
@keyframes animate3{
0%{
transform: translateX(100%);
}
100%{
transform: translateX(-100%);
}
}
a span:nth-child(4){
position: absolute;
bottom:;
left:;
width:4px;
height:100%;
background:linear-gradient(to top,#2f3640,#1779ff);
animation: animate4 1s linear infinite;
animation-delay: 0.5s;
}
@keyframes animate4{
0%{
transform: translateY(100%);
}
100%{
transform: translateY(-100%);
}
}
JS代码(为了解决刚打开网页线条全部存在问题)
var one = document.getElementById("1");
var two = document.getElementById("2");
one.style.visibility = "hidden";
two.style.visibility = "hidden";
window.setTimeout(function(){
one.style.visibility = "visible";
two.style.visibility = "visible";
},500)
最终效果如图:

CSS效果:跑马灯按钮的更多相关文章
- Vue学习笔记四:跑马灯效果
目录 跑马灯原理 HTML 箭头函数 计时器 跑马灯效果 跑马灯原理 先讲讲跑马灯的原理,就是一行字,会滚动,思路是这样的,使用substring方法,一个获取字符串的第一个字,一个获取1后面所有的字 ...
- TextView的跑马灯效果(AS开发实战第二章学习笔记)
TextView的跑马灯效果跑马灯用到的属性与方法说明singleLine 指定文本是否单行显示ellipsize 指定文本超出范围后的省略方式focusable 指定是否获得焦点,跑马灯效果要求设置 ...
- 安卓之文本视图TextView及跑马灯效果
一.基本属性和设置方法 二.跑马灯用到的属性与方法说明 三.省略方式的取值说明 四.跑马灯效果案例代码 (1)布局xml文件 <?xml version="1.0" en ...
- 【跑马灯】纯css3跑马灯demo
我们写跑马灯一般都是用js控制定时器不断循环产生,但是定时器消耗比较大,特别是程序中很多用到定时器的时候,感觉有的时候比较卡.但是css3样式一般不会.这里主要的思路就是用css3代替js定时器实现一 ...
- js_跑马灯
跑马灯?刚听到这个词的时候,脑袋第一个想到的是跑马?嗯?就是香港的那种跑马场.懂?其次就是霓虹灯了,一闪一闪的多好看. 霓虹灯?哦,那是城市的杰作,记忆中是.开往城市边缘开,把车窗都摇下来,用速度换一 ...
- marquee标签跑马灯连续无空白播放效果 纯CSS(chrome opera有效)
marquee似乎没有设置首尾相连播放的属性,内容滚动时总会留出一段marquee本身长度的空隙,某些情况下很不方便: 捣鼓了一会,得出一种解决办法,关键有两点: 1.将需要滚动的内容复制一份于同一行 ...
- csdn左侧个人栏目美化,css英文颜色大全,跑马灯效果,点击转到qq联系,点击转到发送邮件。
跑马灯效果: <a href="http://mmmmmm.me" target="_blank"><marquee><font ...
- js+css简单效果(幕布,跑马灯)
2.js普通的盒子,css的优先级 css的优先级 !important >>>>> style 行内样式 >>>>> #id选择器 # ...
- android中实现跑马灯效果以及AutoCompleteTestView与MultiAutoCompleteTextView的学习
跑马灯效果 1.用过属性的方式实现跑马灯效果 属性: android:singleLine="true" 这个属性是设置TextView文本中文字 ...
随机推荐
- maven介绍
Maven Maven的概念: Maven项目对象模型(POM),可以通过一小段描述信息来管理项目的构建,报告和文档的项目管理工具软件. Maven的作用: Maven可以帮助我们一键管理项目 1.管 ...
- 20190323——HeadFirestPython学习之异常处理
man=[] other=[] try: data=open('sketch.txt') for each_line in data: try: (role,line_spoken)=each_lin ...
- git同时存在两个账号(在同一台电脑上)——三步完成
目录 1.首先是常规设置 2.同时添加两个账号 3.最后一步,配置~/.ssh/config文件 4.补充:有时因为设置了全局账号,因此需要清除 由于本人有连个git账号,个人github账号和公司g ...
- Tensorflow 报错:tensorflow.python.framework.errors_impl.InternalError: Failed to create session.
问题描述 IDE:pycharm,环境中安装tensorflow-gpu 1.8.0 ,Cuda9 ,cudnn 7,等,运行代码 报错如下 tensorflow.python.framework.e ...
- KiB 、十进制单位转换 、二进制单位转换
KiB是kilo binary byte的缩写,指的是千位二进制字节 KB是kilobyte的缩写,指的是千字节 二进制标准命名 十进制国际单位制SI标准: 1 KB= 1,000 Byte ...
- Cognos集成至portal平台查看报表报错RSV-BBP-0022
1. 问题描述 绝对密切性请求“asynchWait_Request”失败,所请求的会话不存在. 2. 问题分析 Session会话传递失败. 3. 解决方案 将cognos所在服务器地址IP添加进I ...
- js promise中如何取到[[PromiseValue]]
返回的值Promise {[[PromiseStatus]]: "resolved", [[PromiseValue]]: "http://dl.stream.qqmus ...
- Java编程思想--控制执行流程
java控制流程设计的关键字包括if-else,while,do-while,for,return,break,continue以及switch.(go-to) 1.while在迭代之前计算一次布尔表 ...
- 本地代码上传到git
1.(先进入项目文件夹)通过命令 git init 把这个目录变成git可以管理的仓库 git init 2.把文件添加到版本库中,使用命令 git add .添加到暂存区里面去,不要忘记后面的小数点 ...
- springboot秒杀课程学习整理1-3
1)实现手机验证码功能,用户注册功能,用户登入功能(这里讲开发流程,及本人遇到的问题,具体实现请看代码) 1.拦截请求,获取请求参数(这里的consumes是个常量,可以定义在baseControll ...