扫二维码与项目经理沟通
我们在微信上24小时期待你的声音
解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流
这篇文章主要介绍“前端开发常用CSS动画代码有哪些”,在日常操作中,相信很多人在前端开发常用CSS动画代码有哪些问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”前端开发常用CSS动画代码有哪些”的疑惑有所帮助!接下来,请跟着小编一起来学习吧!
创新互联建站坚持“要么做到,要么别承诺”的工作理念,服务领域包括:成都网站建设、成都网站设计、企业官网、英文网站、手机端网站、网站推广等服务,满足客户于互联网时代的中牟网站设计、移动媒体设计的需求,帮助企业找到有效的互联网解决方案。努力成为您成熟可靠的网络建设合作伙伴!
/*导入头部和尾部*/
$(document).ready(function(){
$(".footer").load("page/footer.html");
});
但是注意,此时的footer.html不需要是完整的HTML(当时本人自己可是遇到了这个大坑,都是泪/(ㄒoㄒ)/~~),这包含标签内容即可。
在这里小编建了一个前端学习交流扣扣群:132667127,我自己整理的最新的前端资料和高级开发教程,如果有想需要的,可以加群一起学习交流
前端开发常用css动画代码
/*向左移动并弹性显示*/
@-webkit-keyframes fadeToLeftTan{
0%{ -webkit-transform:translateX(100%); opacity:0;}
70%{ -webkit-transform:translateX(-5%); opacity:1;}
80%{ -webkit-transform:translateX(2%); opacity:1;}
90%{ -webkit-transform:translateX(-2%); opacity:1;}
100%{ -webkit-transform:translateX(0); opacity:1;}
}
@keyframes fadeToLeftTan{
0%{ transform:translateX(100%); opacity:0;}
70%{ transform:translateX(-5%); opacity:1;}
80%{ transform:translateX(2%); opacity:1;}
90%{ transform:translateX(-2%); opacity:1;}
100%{ transform:translateX(0); opacity:1;}
}
/*向右移动并弹性显示*/
@-webkit-keyframes fadeToRightTan{
0%{ -webkit-transform:translateX(-100%); opacity:0;}
70%{ -webkit-transform:translateX(5%); opacity:1;}
80%{ -webkit-transform:translateX(-2%); opacity:1;}
90%{ -webkit-transform:translateX(2%); opacity:1;}
100%{ -webkit-transform:translateX(0); opacity:1;}
}
@keyframes fadeToRightTan{
0%{ transform:translateX(-100%); opacity:0;}
70%{ transform:translateX(5%); opacity:1;}
80%{ transform:translateX(-2%); opacity:1;}
90%{ transform:translateX(2%); opacity:1;}
100%{ transform:translateX(0); opacity:1;}
}
/*向上移动并弹性显示*/
@-webkit-keyframes fadeToTopTan{
0%{ -webkit-transform:translateY(100%); opacity:0;}
70%{ -webkit-transform:translateY(-5%); opacity:1;}
80%{ -webkit-transform:translateY(2%); opacity:1;}
90%{ -webkit-transform:translateY(-2%); opacity:1;}
100%{ -webkit-transform:translateY(0); opacity:1;}
}
@keyframes fadeToTopTan{
0%{ transform:translateY(100%); opacity:0;}
70%{ transform:translateY(-5%); opacity:1;}
80%{ transform:translateY(2%); opacity:1;}
90%{ transform:translateY(-2%); opacity:1;}
100%{ transform:translateY(0); opacity:1;}
}
/*向下移动并弹性显示*/
@-webkit-keyframes fadeToDownTan{
0%{ -webkit-transform:translateY(-100%); opacity:0;}
70%{ -webkit-transform:translateY(5%); opacity:1;}
80%{ -webkit-transform:translateY(-2%); opacity:1;}
90%{ -webkit-transform:translateY(2%); opacity:1;}
100%{ -webkit-transform:translateY(0); opacity:1;}
}
@keyframes fadeToDownTan{
0%{ transform:translateY(-100%); opacity:0;}
70%{ transform:translateY(5%); opacity:1;}
80%{ transform:translateY(-2%); opacity:1;}
90%{ transform:translateY(2%); opacity:1;}
100%{ transform:translateY(0); opacity:1;}
}
/*从大向小变化弹性显示*/
@-webkit-keyframes fadeInMaxToMinTan{
0%{ -webkit-transform:scale(2); opacity:0;}
70%{ -webkit-transform:scale(.9); opacity:1;}
85%{ -webkit-transform:scale(1.1); opacity:1;}
100%{ -webkit-transform:scale(1); opacity:1;}
}
@keyframes fadeInMaxToMinTan{
0%{ transform:scale(2); opacity:0;}
70%{ transform:scale(.9); opacity:1;}
85%{ transform:scale(1.1); opacity:1;}
100%{ transform:scale(1); opacity:1;}
}
/*从小向大变化弹性显示*/
@-webkit-keyframes fadeInMinToMaxTan{
0%{ -webkit-transform:scale(0); opacity:0;}
70%{ -webkit-transform:scale(1.1); opacity:1;}
85%{ -webkit-transform:scale(.9); opacity:1;}
100%{ -webkit-transform:scale(1); opacity:1;}
}
@keyframes fadeInMinToMaxTan{
0%{ transform:scale(0); opacity:0;}
70%{ transform:scale(1.1); opacity:1;}
85%{ transform:scale(.9); opacity:1;}
100%{ transform:scale(1); opacity:1;}
}
/**********************************/
/*向左移动显示*/
@-webkit-keyframes fadeToLeft{
0%{ -webkit-transform:translateX(100%); opacity:0;}
100%{ -webkit-transform:translateX(0); opacity:1;}
}
@keyframes fadeToLeft{
0%{ transform:translateX(100%); opacity:0;}
100%{ transform:translateX(0); opacity:1;}
}
/*向右移动显示*/
@-webkit-keyframes fadeToRight{
0%{ -webkit-transform:translateX(-100%); opacity:0;}
100%{ -webkit-transform:translateX(0); opacity:1;}
}
@keyframes fadeToRight{
0%{ transform:translateX(-100%); opacity:0;}
100%{ transform:translateX(0); opacity:1;}
}
/*向上移动显示*/
@-webkit-keyframes fadeToTop{
0%{ -webkit-transform:translateY(100%); opacity:0;}
100%{ -webkit-transform:translateY(0); opacity:1;}
}
@keyframes fadeToTop{
0%{ transform:translateY(100%); opacity:0;}
100%{ transform:translateY(0); opacity:1;}
}
/*向上60移动显示*/
@-webkit-keyframes fadeToTop60{
0%{ -webkit-transform:translateY(60px); opacity:0;}
100%{ -webkit-transform:translateY(0); opacity:1;}
}
@keyframes fadeToTop60{
0%{ transform:translateY(60px); opacity:0;}
100%{ transform:translateY(0); opacity:1;}
}
/*向下移动显示*/
@-webkit-keyframes fadeToDown{
0%{ -webkit-transform:translateY(-100%); opacity:0;}
100%{ -webkit-transform:translateY(0); opacity:1;}
}
@keyframes fadeToDown{
0%{ transform:translateY(-100%); opacity:0;}
100%{ transform:translateY(0); opacity:1;}
}
/*向下60移动显示*/
@-webkit-keyframes fadeToDown60{
0%{ -webkit-transform:translateY(-60px); opacity:0;}
100%{ -webkit-transform:translateY(0); opacity:1;}
}
@keyframes fadeToDown60{
0%{ transform:translateY(-60px); opacity:0;}
100%{ transform:translateY(0); opacity:1;}
}
/**********************************/
/*上下微移漂浮*/
@-webkit-keyframes flashTopDown{
0%{ -webkit-transform:translateY(0); opacity:1;}
100%{ -webkit-transform:translateY(8px); opacity:.8;}
}
@keyframes flashTopDown{
0%{ transform:translateY(0); opacity:1;}
100%{ transform:translateY(8px); opacity:.8;}
}
/**********************************/
/*从大向小变化显示*/
@-webkit-keyframes fadeInMaxToMin{
0%{ -webkit-transform:scale(2); opacity:0;}
100%{ -webkit-transform:scale(1); opacity:1;}
}
@keyframes fadeInMaxToMin{
0%{ transform:scale(2); opacity:0;}
100%{ transform:scale(1); opacity:1;}
}
/*从小向大变化显示*/
@-webkit-keyframes fadeInMinToMax{
0%{ -webkit-transform:scale(0); opacity:0;}
100%{ -webkit-transform:scale(1); opacity:1;}
}
@keyframes fadeInMinToMax{
0%{ transform:scale(0); opacity:0;}
100%{ transform:scale(1); opacity:1;}
}
/**********************************/
/*大小闪动变化 变小*/
@-webkit-keyframes flashMaxMin{
0%{ -webkit-transform:scale(1);}
100%{ -webkit-transform:scale(.98);}
}
@keyframes flashMaxMin{
0%{ transform:scale(1);}
100%{ transform:scale(.98);}
}
/*大小闪动变化变大*/
@-webkit-keyframes flashMax{
0%{ -webkit-transform:scale(1);}
100%{ -webkit-transform:scale(1.05);}
}
@keyframes flashMax{
0%{ transform:scale(1);}
100%{ transform:scale(1.05);}
}
/**********************************/
/*渐显*/
@-webkit-keyframes fadeIn{
0%{ opacity:0;}
100%{ opacity:1;}
}
@keyframes fadeIn{
0%{ opacity:0;}
100%{ opacity:1;}
}
/*渐隐*/
@-webkit-keyframes fadeOut{
0%{ opacity:1;}
100%{ opacity:0;}
}
@keyframes fadeOut{
0%{ opacity:1;}
100%{ opacity:0;}
}
前端开发,移动端公共样式
/* 禁用iPhone中Safari的字号自动调整 */
html {
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
/* 解决IOS默认滑动很卡的情况 */
-webkit-overflow-scrolling : touch;
}
/* 禁止缩放表单 */
input[type="submit"], input[type="reset"], input[type="button"], input {
resize: none;
border: none;
}
/* 取消链接高亮 */
body, div, ul, li, ol, h2, h3, h4, h5, h6, h7, input, textarea, select, p, dl, dt, dd, a, img, button, form, table, th, tr, td, tbody, article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section {
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
/* 设置HTML5元素为块 */
article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section {
display: block;
}
/* 图片自适应 */
img {
width: 100%;
height: auto;
width: auto9; /* ie8 */
display: block;
-ms-interpolation-mode: bicubic;/*为了照顾ie图片缩放失真*/
}
/* 初始化 */
body, div, ul, li, ol, h2, h3, h4, h5, h6, h7, input, textarea, select, p, dl, dt, dd, a, img, button,
form, table, th, tr, td, tbody, article, aside, details, figcaption, figure, footer, header, hgroup,
menu, nav, section {
margin: 0;
padding: 0;
}
body {
font: 12px/1.5 'Microsoft YaHei','宋体', Tahoma, Arial, sans-serif;
color: #fff;
background-color: #F7F7F7;
}
em, i {
font-style: normal;
}
ul,li{
list-style-type: none;
}
strong {
font-weight: normal;
}
table{
border-collapse:collapse;
border-spacing:0
}
textarea {
resize:none; /*禁用了文本的拖拉,尤其在谷歌下*/
}
p {
word-wrap:break-word; /* 不够的单词自动换行 而不会被截掉 */
}
.clearfix:after {
content: "";
display: block;
visibility: hidden;
height: 0;
clear: both;
}
.clearfix {
zoom: 1;
}
a {
text-decoration: none;
color: #fff;
font-family: 'Microsoft YaHei', Tahoma, Arial, sans-serif;
}
a:hover {
text-decoration: none;
}
ul, ol {
list-style: none;
}
h2, h3, h4, h5, h6, h7 {
font-size: 100%;
font-family: 'Microsoft YaHei';
}
img {
border: none;
}
input{
font-family: 'Microsoft YaHei';
}
/*单行溢出*/
.one-txt-cut{
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
/*多行溢出 手机端使用*/
.txt-cut{
overflow : hidden;
text-overflow: ellipsis;
display: -webkit-box;
/* -webkit-line-clamp: 2; */
-webkit-box-orient: vertical;
}
/* 移动端点击a链接出现蓝色背景问题解决 */
a:link,a:active,a:visited,a:hover {
background: none;
-webkit-tap-highlight-color: rgba(0,0,0,0);
-webkit-tap-highlight-color: transparent;
}
.overflow {overflow:hidden; }
.w50{
width: 50%;
}
.w25{
width: 25%;
}
.w20{
width: 20%;
}
.w33{
width: 33.333333%;
}
.fl{
float: left;
}
.fr{
float: right;
}
.db{
display: block !important;
}
.dn{
display: none;
}
/* 附加 */
到此,关于“前端开发常用CSS动画代码有哪些”的学习就结束了,希望能够解决大家的疑惑。理论与实践的搭配能更好的帮助大家学习,快去试试吧!若想继续学习更多相关知识,请继续关注创新互联网站,小编会继续努力为大家带来更多实用的文章!
我们在微信上24小时期待你的声音
解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流