【发布时间】:2018-02-19 13:49:46
【问题描述】:
我将 div 设置为列样式
[div1][div2][div3]
我想像这样在光标悬停时单独展开每个 div(以某种方式覆盖其他 div):
[div1..................]
到目前为止,我的工作方式是这样的:https://codepen.io/Cigoler/pen/VMZeaB
body {
background: #cacaca;
padding: 5em;
}
.container {
position: relative;
width: 100%;
overflow: hidden;
}
.item {
padding: 0.25em;
text-align: center;
display: inline-block;
width: 33%;
height: 200px;
background: whitesmoke;
vertical-align: middle;
}
.item:hover {
cursor: pointer;
position: absolute;
left: 0;
width: 100%;
-webkit-transition: all 0.3s ease-out;
transition: all 0.3s ease-out;
}
.test1 {
background: #c3c3c3;
}
.test2 {
background: #fafafa;
}
.test3 {
background: #474747;
color: white;
}
<div class="row expanded">
<div class="container">
<div class="item test1">
<p>Test One</p>
</div>
<div class="item test2">
<p>Test Two</p>
</div>
<div class="item test3">
<p>Test Three</p>
</div>
</div>
</div>
问题是;我想更进一步并顺利地为过渡设置动画。但是,每当我添加一个简单的过渡时,它都会变得很笨拙。我猜这是因为浏览器在动画之间的 div 之间发生了冲突。
对解决这个问题有什么帮助吗?
【问题讨论】:
标签: html css flexbox css-transitions