gpt4 book ai didi

html - 小型设备上的引导卡问题

转载 作者:太空宇宙 更新时间:2023-11-04 05:51:06 25 4
gpt4 key购买 nike

我在使用 boostrap 卡的小型设备上遇到问题。我正在使用悬停效果来滑动内容。但在小型设备上,内容会影响图像。我真的不知道如何使用 position: absolute 使内容直接在图像之后开始。我只想看到名字和标题。当鼠标悬停时,其余内容会以向上滑动的方式显示。

.team-card {
border:0!important;
border-radius:5px!important;
overflow:hidden!important;
}

.team-card .card-body .card-title,.team-card .card-body .card-text {
text-align:center;
margin:0;
}

.team-card .card-body {
position:absolute;
width:100%;
height:100%;
left:0;
top:255px;
background-color:#fff;
-moz-transition:all .3s ease-in-out;
-o-transition:all .3s ease-in-out;
-webkit-transition:all .3s ease-in-out;
transition:all .3s ease-in-out
}

.team-card .card-body p {
line-height:1.6em;
}

.team-card:hover .card-body {
top:0;
}

.team-card .card-body .card-text {
margin-bottom:15px;
}
<html>
<head><link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" />
</head>
<body>
<div class="card team-card">
<img src="https://png.pngtree.com/png-vector/20190704/ourlarge/pngtree-vector-user-young-boy-avatar-icon-png-image_1538408.jpg" class="card-img-top" alt="">
<div class="card-body">
<h5 class="card-title">John Doe</h5>
<p class="card-text">Business Director</p>
<p>Board member (core-team) previous Director-Business Development at EM6 and earlier at Syncada.</p>
</div>
</div>
</body>
</html

感谢您的帮助。

最佳答案

您看到此行为是因为您对 .team-card .card-body 类的 top 属性使用了绝对数字;我们可以做的是分配以下内容:top:calc(100% - 89px); 这是 card-body 的完整高度,我们删除 89px 这是card-titlecard-text 的高度...

下面的工作片段:

.team-card {
border: 0!important;
border-radius: 5px!important;
overflow: hidden!important;
}

.team-card .card-body .card-title,
.team-card .card-body .card-text {
text-align: center;
margin: 0;
}

.team-card .card-body {
position: absolute;
width: 100%;
height: 100%;
left: 0;
top: calc(100% - 89px);
background-color: #fff;
-moz-transition: all .3s ease-in-out;
-o-transition: all .3s ease-in-out;
-webkit-transition: all .3s ease-in-out;
transition: all .3s ease-in-out
}

.team-card .card-body p {
line-height: 1.6em;
}

.team-card:hover .card-body {
top: 0;
}

.team-card .card-body .card-text {
margin-bottom: 15px;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>


<div class="card team-card">
<img src="https://png.pngtree.com/png-vector/20190704/ourlarge/pngtree-vector-user-young-boy-avatar-icon-png-image_1538408.jpg" class="card-img-top" alt="">
<div class="card-body">
<h5 class="card-title">John Doe</h5>
<p class="card-text">Business Director</p>
<p>Board member (core-team) previous Director-Business Development at EM6 and earlier at Syncada.</p>
</div>
</div>

关于html - 小型设备上的引导卡问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58259356/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com