老师,为什么每次刷新的时候course还多了个动画?
course-plan里的内容从左上角到右下角显示出来
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Homework</title>
<link rel="stylesheet" type="text/css" href="css/homework.css">
</head>
<body>
<header class="header">
<div class="logo"></div>
<nav class="nav">
<a href="" class="nav-item">课程</a>
<a href="" class="nav-item nav-item_icon_new">职业路径</a>
<a href="" class="nav-item">实战</a>
<a href="" class="nav-item">猿问</a>
<a href="" class="nav-item">手记</a>
</nav>
<div class="profile">
<a href="" class="profile-item profile-cart"></a>
<a href="" class="profile-item profile-message"></a>
<a href="" class="profile-item profile-ava"></a>
</div>
<div class="search">
<input type="text" class="search-input">
<a href="" class="search-submit">
</div>
</header>
<div class="banner"></div>
<div class="courses">
<div class="courses-list">
<div class="course">
<div class="course-cover"><img src="imgs/course1.jpg"></div>
<div class="course-plan">
<h2 class="caption">前端小白入门系列课程</h2>
<div class="course-plan-times">33课<span class="course-plan-person">368人在学</span></div>
<div class="course-plan-desc">带你通过系统学习,完成从“会做网页”到“做出好的动态网页”的蜕变</div>
</div>
<div class="course-price"><span><i>¥</i>499.00</span></div>
</div>
<div class="course">
<div class="course-cover"><img src="imgs/course2.jpg"></div>
<div class="course-plan">
<h2 class="caption">HTML5与CSS3实现动态网页系列课程</h2>
<div class="course-plan-times">33课<span class="course-plan-person">368人在学</span></div>
<div class="course-plan-desc">带你通过系统学习,完成从“会做网页”到“做出好的动态网页”的蜕变</div>
</div>
<div class="course-price"><span><i>¥</i>499.00</span></div>
</div>
<div class="course">
<div class="course-cover"><img src="imgs/course3.jpg"></div>
<div class="course-plan">
<h2 class="caption">前端小白入门系列课程</h2>
<div class="course-plan-times">33课<span class="course-plan-person">368人在学</span></div>
<div class="course-plan-desc">带你通过系统学习,完成从“会做网页”到“做出好的动态网页”的蜕变,带你通过系统学习</div>
</div>
<div class="course-price"><span><i>¥</i>499.00</span></div>
</div>
<div class="course">
<div class="course-cover"><img src="imgs/course4.jpg"></div>
<div class="course-plan">
<h2 class="caption">前端小白入门系列课程</h2>
<div class="course-plan-times">33课<span class="course-plan-person">368人在学</span></div>
<div class="course-plan-desc">带你通过系统学习,完成从“会做网页”到“做出好的动态网页”的蜕变</div>
</div>
<div class="course-price"><span><i>¥</i>499.00</span></div>
</div>
<div class="course">
<div class="course-cover"><img src="imgs/course5.jpg"></div>
<div class="course-plan">
<h2 class="caption">前端小白入门系列课程</h2>
<div class="course-plan-times">33课<span class="course-plan-person">368人在学</span></div>
<div class="course-plan-desc">带你通过系统学习,完成从“会做网页”到“做出好的动态网页”的蜕变</div>
</div>
<div class="course-price"><span><i>¥</i>499.00</span></div>
</div>
<div class="course">
<div class="course-cover"><img src="imgs/course6.jpg"></div>
<div class="course-plan">
<h2 class="caption">前端小白入门系列课程</h2>
<div class="course-plan-times">33课<span class="course-plan-person">368人在学</span></div>
<div class="course-plan-desc">带你通过系统学习,完成从“会做网页”到“做出好的动态网页”的蜕变</div>
</div>
<div class="course-price"><span><i>¥</i>499.00</span></div>
</div>
<div class="course">
<div class="course-cover"><img src="imgs/course7.jpg"></div>
<div class="course-plan">
<h2 class="caption">前端小白入门系列课程</h2>
<div class="course-plan-times">33课<span class="course-plan-person">368人在学</span></div>
<div class="course-plan-desc">带你通过系统学习,完成从“会做网页”到“做出好的动态网页”的蜕变</div>
</div>
<div class="course-price"><span><i>¥</i>499.00</span></div>
</div>
<div class="course">
<div class="course-cover"><img src="imgs/course8.jpg"></div>
<div class="course-plan">
<h2 class="caption">前端小白入门系列课程</h2>
<div class="course-plan-times">33课<span class="course-plan-person">368人在学</span></div>
<div class="course-plan-desc">带你通过系统学习,完成从“会做网页”到“做出好的动态网页”的蜕变</div>
</div>
<div class="course-price"><span><i>¥</i>499.00</span></div>
</div>
<div class="course">
<div class="course-cover"><img src="imgs/course9.jpg"></div>
<div class="course-plan">
<h2 class="caption">HTML5与CSS3实现动态网页系列课程HTML5与CSS3实现动态网页</h2>
<div class="course-plan-times">33课<span class="course-plan-person">368人在学</span></div>
<div class="course-plan-desc">带你通过系统学习,完成从“会做网页”到“做出好的动态网页”的蜕变</div>
</div>
<div class="course-price"><span><i>¥</i>499.00</span></div>
</div>
</div>
</div>
<footer class="footer">
<div class="footer-link">
<a href="" class="footer-link-item">网站首页</a>
<a href="" class="footer-link-item">企业合作</a>
<a href="" class="footer-link-item">人才招聘</a>
<a href="" class="footer-link-item">联系我们</a>
<a href="" class="footer-link-item">讲师招募</a>
<a href="" class="footer-link-item">常见问题</a>
<a href="" class="footer-link-item">意见反馈</a>
<a href="" class="footer-link-item">慕课大学</a>
<a href="" class="footer-link-item">友情链接</a>
</div>
<div class="footer-copy">
Copyright © 2016 imooc.com All Rights Reserved | 京ICP备 13046642号-2
</div>
<div class="footer-share">
<a href="" class="footer-share-item footer-share-item_i_1"></a>
<a href="" class="footer-share-item footer-share-item_i_2"></a>
<a href="" class="footer-share-item footer-share-item_i_3"></a>
</div>
</footer>
</body>
</html>
*{
margin:0;
padding:0;
}
a{
text-decoration:none;
}
//布局样式
#layout(@name){
& when(@name=header){
height:60px;
#bg-color(black);
}
& when(@name=banner){
height:560px;
background-color:#ccc;
}
& when(@name=courses){
height:750px;
#bg-color(white);
}
& when(@name=footer){
height:98px;
#bg-color(black);
}
position:relative;
}
#bg-color(@name){
& when(@name=black){
background-color:black;
}
& when(@name=white){
background-color:#fff;
}
& when(@name=light){
background-color:#363c41;
}
}
#ft-size(@name){
& when(@name=small){
font-size:12px;
}
& when(@name=medium){
font-size:14px;
}
& when(@name=large){
font-size:16px;
}
& when(@name=big){
font-size:22px;
}
& when(@name=title){
font-size:32px;
}
}
#color(@name){
& when(@name=dark){
color:#5c646b;
}
& when(@name=black){
color:#141914;
}
& when(@name=white){
color:#fbfbfb;
}
& when(@name=yellow){
color:#ffcc33;
}
& when(@name=red){
color:red;
}
& when(@name=weak){
color:#959aa0;
}
}
//课程模块
#course-box(){
width:240px;
height:250px;
.fl();
margin:0 20px 34px 0;
box-shadow:0 4px 8px rgba(7,17,27,.1);
#bg-color(white);
position:relative;
top:-110px;
left:0;
#bg-img("titlebg.png");
#decorate-bottom();
#radius(6px);
}
#decorate-bottom(){
&:before{
content:'';
display:block;
box-shadow:0 8px 16px rgba(7,17,27,.2);
#bg-color(white);
#radius(4px);
width:98%;
height:3px;
position:absolute;
left:1%;
bottom:-5px;
}
&:after{
content:'';
display:block;
box-shadow:0 8px 16px rgba(7,17,27,.2);
#bg-color(white);
#radius(4px);
width:96%;
height:3px;
position:absolute;
left:2%;
bottom:-11px;
}
}
//通用样式
#cover-background(){
background-size:cover;
background+_:no-repeat center;
}
.fl(){
float:left;
}
.fr(){
float:right;
}
.clearfix(){
&:after{
content:'';
display:block;
clear:both;
font-size:0;
line-height:0;
zoom:1;
}
}
//功能样式
#line-height(@h){
height:@h;
line-height:@h;
}
#square(@w){
width:@w;
height:@w;
}
#bg-img(@src){
background-image:url("../imgs/@{src}");
}
#radius(@radius:50%){
border-radius:@radius;
}
#center-h(@width){
left:50%;
margin-left:@width*-.5;
}
//模块样式
.header{
#layout(header);
.logo{
width:128px;
height:36px;
background+_:url(../imgs/logo.png);
#cover-background();
.fl();
margin:12px 25px;
}
.nav{
.fl();
height:100%;
&-item{
#ft-size(medium);
#color(white);
#line-height(60px);
.fl();
display:block;
padding:0 25px;
&:hover{
#bg-color(light);
}
&_icon_new{
#bg-color(light);
position:relative;
&:after{
content:'';
display:block;
position:absolute;
#bg-img("icon-new.png");
#square(16px);
top:10px;
right:10px;
}
}
}
}
.search{
.fr();
height:36px;
position:relative;
margin:12px 25px;
padding-right:25px;
&-input{
border:none;
outline:none;
width:242px;
border-bottom:1px solid #666;
#bg-color(black);
#line-height(36px);
}
&-submit{
display:block;
#square(22px);
#bg-img("icon-1-sprite_w22.png");
background-position:0 0;
position:absolute;
top:4px;
right:25px;
}
&::before{
content:'前端入门';
display:block;
#color(dark);
#bg-color(dark);
#line-height(30px);
text-align:center;
#ft-size(small);
position:absolute;
left:0;
top:0;
}
}
.profile{
.fr();
&-item{
display:block;
#square(60px);
.fl();
margin-right:1px;
position:relative;
}
&-cart:before,
&-message:before{
content:'';
display:block;
#square(22px);
#bg-img("icon-1-sprite_w22.png");
position:absolute;
top:19px;
left:19px;
}
&-message:before{
background-position:0 -44px;
}
&-ava{
#square(36px);
#bg-color(light);
#radius();
margin:12px;
background+_:url(../imgs/ava.jpg);
#cover-background();
}
}
}
.banner{
#layout(banner);
#bg-img("bg.jpg");
width:100%;
background-position:center;
background-size:cover;
}
.courses{
#layout(courses);
&-list{
width:1020px;
margin:0 auto;
position:relative;
.clearfix();
.course{
#course-box();
&:nth-child(4n){
margin-right:0;
}
&-cover{
height:90px;
img{
width:100%;
#radius(4px);
}
#radius(10px);
}
&-plan{
width:260px-40px;
padding:16px 0 0 20px;
position:absolute;
top:105px;
#bg-img("titlebg.png");
transition:all 1s;
&-times{
#ft-size(small);
#color(weak);
#line-height(34px);
padding-top:10px;
}
&-person{
padding-left:8px;
}
&-desc{
padding-top:8px;
border-top:1px solid #d9dde1;
#ft-size(small);
#color(weak);
}
}
&-price{
position:absolute;
bottom:0;
padding-left:20px;
height:62px;
width:100%;
#bg-color(white);
#ft-size(small);
#color(red);
i{
font-style:normal;
vertical-align:super;
}
span{
position:absolute;
bottom:20px;
}
}
.caption{
#ft-size(small);
#color(black);
#line-height(18px);
}
&:hover .course-plan{
top:40px;
}
&:last-child{
#center-h(240px);
}
#radius(10px);
}
}
}
.footer{
#layout(footer);
#ft-size(small);
&-link{
width:1200px;
margin:0 auto;
padding:30px 0 16px 40px;
#line-height(12px);
&-item{
display:inline-block;
margin-right:30px;
.fl();
#color(weak);
&:hover{
#color(white);
}
}
}
&-copy{
width:1200px;
margin:0 auto;
#line-height(12px);
#color(dark);
padding-left:40px;
}
&-share{
width:135px;
height:32px;
position:absolute;
right:40px;
top:34px;
&-item{
.fl();
display:block;
margin-right:13px;
#square(32px);
#bg-img("footer-sprite.png");
opacity:.6;
&:hover{
opacity:1;
}
&_i_1{
background-position:0 -279px;
position:relative;
&:before{
content:'';
display:block;
#bg-img("footer-sprite.png");
background-position:0 0;
width:170px;
height:220px;
opacity:1;
position:absolute;
top:-217px;
left:-69px;
display:none;
}
&:hover footer-share-item_i_1:before{
display:block;
}
}
&_i_2{
background-position:0 -321px;
}
&_i_3{
background-position:0 -363px;
}
}
}
}
正在回答
使用Chrome浏览器测试是没有这个动画效果的,但是使用360极速浏览器测试是有的。
是因为transition过渡中设置的改变属性是all,360浏览器在解析的时候所有属性可能都会解析到,所以建议改成只改变动画的属性即可:
自己再试试。
- 参与学习 人
- 提交作业 2198 份
- 解答问题 5012 个
如果你有web端基础,既想进阶,又想进军移动端开发,那就来吧,我们专题为你带来的课程有HTML5、CSS3、移动基础、响应式、bootstrap、less等,让你在前端道路上畅通无阻!
了解课程
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星