温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

前端开发常用CSS动画代码有哪些

发布时间:2021-11-04 15:25:04 来源:亿速云 阅读:109 作者:iii 栏目:web开发

这篇文章主要介绍“前端开发常用CSS动画代码有哪些”,在日常操作中,相信很多人在前端开发常用CSS动画代码有哪些问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”前端开发常用CSS动画代码有哪些”的疑惑有所帮助!接下来,请跟着小编一起来学习吧!

/*导入头部和尾部*/
$(document).ready(function(){
  $(".footer").load("page/footer.html");
});

但是注意,此时的footer.html不需要是完整的HTML(当时本人自己可是遇到了这个大坑,都是泪/(ㄒoㄒ)/~~),这包含标签内容即可。

在这里小编建了一个前端学习交流扣扣群:132667127,我自己整理的最新的前端资料和高级开发教程,如果有想需要的,可以加群一起学习交流

<!--footer.html页面-->
<footer>
<ul class="g-flex">
<li class="g-flex-auto"><a href="#" class="i-b">首页</a></li>
<li class="g-flex-auto"><a href="#" class="i-b">分类</a></li>
<li class="g-flex-auto"><a href="#" class="i-b">订单</a></li>
<li class="g-flex-auto"><a href="#" class="i-b">我的</a></li>
</ul>
</footer>

前端开发常用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动画代码有哪些”的学习就结束了,希望能够解决大家的疑惑。理论与实践的搭配能更好的帮助大家学习,快去试试吧!若想继续学习更多相关知识,请继续关注亿速云网站,小编会继续努力为大家带来更多实用的文章!

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

css
AI