html - 无法执行 CSS 转换。有人可以看到并帮助我吗?
问题描述
我对整个 CSS 和 Web 开发非常陌生。我一直在通过查看 W3 和 Codepen 上的示例来学习。我在可滑动的幻灯片中准备了一个 flexbox。我希望放大每张卡片并显示描述。我也把链接放在这里..有人可以解释我哪里出错了吗?
我想在我的 flexbox 中的每个选项卡上进行 translazeZ 转换。我希望每个选项卡都扩展为更大的部分。
.card{
display: flex;
flex-wrap: wrap;
flex-grow: 4;
font-size: 22px;
padding: 25px;
margin: 15px;
color: white;
border-radius: 5px;
background: blue;
transform-style: preserve-3d;
transition: transform 0.5s;
justify-content: center;
align-content: center;
}
.card div {
position: absolute;
width: 100%;
height: 100%;
border-radius: 6px;
background: blue;
display: flex;
justify-content: center;
transform-style: preserve-3d;
align-items: center;
transition: 1s;
color: white;
}
.card .des {
display: none;
}
.card.flipped {
transform: translateZ(100px);
}
解决方案
我认为这就是您想要的,但是您必须将描述包装在一个元素(例如“span”)中,然后再将其包装在一个容器(例如“div”)中,以便以 flex 为中心,因为 toggle() 可以display: block;
。
$('.container').on('click', function() {
$('.card').toggleClass('flipped');
$('.des').toggle();
});
.container {
position: relative;
width: 300px;
height: 200px;
perspective: 800px;
}
.card {
display: flex;
flex-wrap: wrap;
flex-grow: 4;
justify-content: center;
align-content: center;
width: 100%;
height: 100%;
transform-style: preserve-3d;
transition: transform 0.5s;
padding: 25px;
margin: 15px;
border-radius: 5px;
font-size: 22px;
background: blue;
color: white;
}
.card div {
display: flex;
justify-content: center;
align-items: center;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
transition: transform 1s;
border-radius: 6px;
background: blue;
color: white;
}
.card .des {
display: none;
}
.card.flipped {
transform: translateZ(100px);
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="container">
<div class="card">
<div>
<h5>Integration</h5><br>
<div class="des">
<div>
<span>Description, Yo, what up?</span>
</div>
</div>
</div>
</div>
</div>
推荐阅读
- apple-watch - HealthKit 提高心率通知变量?
- git - 我在哪里可以报告 GitHub 错误?
- python - Python current.futures 多次导入库(在顶级范围内多次执行代码)
- matlab - 使用matlab对声音进行反卷积
- java - hibernate get me 引起:java.lang.AbstractMethodError
- c++ - 使用 std::vector 是否安全
作为异构记录的存储? - firebase - 文档中的 Firestore 更新数组字段
- scala - 选择以特定模式开头的字段:Spark XML Parsing
- python - 将 dash_html_components 传递给 Jinja 模板
- colors - 如何添加png文件