gpt4 book ai didi

html - bootstrap 4 中的全空间图像

转载 作者:行者123 更新时间:2023-11-27 23:42:34 25 4
gpt4 key购买 nike

我想要这样的横幅:

在手机端显示时

Mobile

在桌面显示时

Desktop

为此我尝试了:

.card-body {
display: flex;
}

@media(min-width:768px) {
.card-title {
font-size: 3vw;
word-break: break-all;
}
}

@media(max-width:767px) {
.card-title {
font-size: 8.5vw;
word-break: break-all;
}
}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">

<div class="shadow card col-md-3 ml-4 mt-3 mb-3 mr-4" style="background-color: #F0E78C">
<div class="row">
<div class="card-body col-12 border p-0">
<img src="https://i.imgur.com/ZyROdEa.png" width="90">
<h5 class="card-title float-right">9999999999</h5>
</div>
<div class="card-body col-12 border p-0">
<a href="" class="btn btn-block" style="background-color: #00BFFF; color: white;">Get Details</a>
</div>
</div>
</div>

但是在上面的代码中,文本是左对齐的,但是我使用的是float-right

最佳答案

使用 margin-left: auto

.card-body {
display: flex;;
}

.card-title {
margin-left: auto;
}

h5 {
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}

@media(min-width:768px) {
.card-title {
font-size: 3vw;
word-break: break-all;
}
}

@media(max-width:767px) {
.card-title {
font-size: 8.5vw;
word-break: break-all;
}
}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">

<div class="shadow card col-md-3 ml-4 mt-3 mb-3 mr-4" style="background-color: #F0E78C">
<div class="row">
<div class="card-body col-12 border p-0">
<img src="https://i.imgur.com/ZyROdEa.png" width="90">
<h5 class="card-title float-right">99999952341624624629999</h5>
</div>
<div class="card-body col-12 border p-0">
<a href="" class="btn btn-block" style="background-color: #00BFFF; color: white;">Get Details</a>
</div>
</div>
</div>

关于html - bootstrap 4 中的全空间图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56964517/

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