【发布时间】:2019-08-30 06:58:10
【问题描述】:
我设置了transition: all ease-in-out 1s;,但以同样的方式更改grid-column 的属性不适用于transition。
这里还有其他使用动画的方法吗?
<div class="projects">
<div class="project" style="background: url(img/p1.png) center no-repeat / cover"></div>
<div class="project" style="background: url(img/p2.jpg) center no-repeat / cover"></div>
<div class="project" style="background: url(img/p3.jpg) center no-repeat / cover"></div>
<div class="project" style="background: url(img/p4.png) center no-repeat / cover"></div>
</div>
.projects {
width: 100%;
height: 500px;
display: grid;
grid-template-columns: repeat(4, minmax(100px, 1fr));
grid-auto-rows: 500px;
}
.project {
width: 100%;
transition: all ease-in-out 1s;
}
.project:nth-child(1) {
grid-column: 1;
grid-row: 1;
}
.project:nth-child(1):hover {
grid-column: 1/3;
z-index: 2;
}
我在codepen上传了一个精简版
【问题讨论】:
标签: html css css-transitions css-grid