gpt4 book ai didi

css - Bootstrap 3 列中图像的高度相同(Material Kit Pro UI)

转载 作者:太空宇宙 更新时间:2023-11-04 07:37:54 24 4
gpt4 key购买 nike

所以我开始使用 Material Kit UI,现在您可以在图片中看到,列内的图像高度不同。 enter image description here

还有代码:

<div class="container-fluid sec1">
<div class="row">
<div class="col-sm-3 col-md-2 col-lg-2">
<div class="anime card card-blog">
<div class="card-image animeimg">
<div class="timenumber">
<h4>2 دقیقه قبل</h4>
</div>
<a href="#" title="Sword Art Online">
<img class="img" src="/image/Ki247.jpg">
</a>
<div class="colored-shadow" style="background-image: url(&quot;/image/Ki247.jpg&quot;); opacity: 1;"></div>
<div class="ripple-container"></div>
</div>

<div class="card-content sectit">
<h6 class="category text-success">در حال پخش</h6>
<h4 class="card-title">
<a href="#" title="Sword Art Online">Sword Art Online</a>
</h4>

<div class="footer episodenumber">
قسمت 13
</div>
</div>
</div>
</div>
</div>
</div>

和CSS:

    .anime {
margin-bottom: 20px;
background: none !important;
box-shadow: none !important;
}
.card-blog {
margin-top: 30px;
}
.card {
display: inline-block;
position: relative;
width: 100%;
margin-bottom: 30px;
border-radius: 6px;
color: rgba(0,0,0, 0.87);
background: #fff;
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 3px 1px -2px rgba(0, 0, 0, 0.2), 0 1px 5px 0 rgba(0, 0, 0, 0.12);
}
.card .card-image {
height: 60%;
position: relative;
z-index: 1;
margin-left: 15px;
margin-right: 15px;
margin-top: -30px;
border-radius: 6px;
}
.animeimg {
margin-left: 0 !important;
margin-right: 0 !important;
}
.timenumber {
z-index: 9999;
font-size: 12px !important;
float: right;
position: absolute;
padding: 8px 10px;
color: #fff;
}
a {
text-decoration: none !important;
}
.card .card-image img {
width: 100%;
border-radius: 6px;
pointer-events: none;
box-shadow: 0 5px 15px -8px rgba(0, 0, 0, 0.24), 0 8px 10px -5px rgba(0, 0, 0, 0.2);
}
.card img {
width: 100%;
height: auto;
}
.card .card-image .colored-shadow {
transform: scale(0.94);
top: 12px;
filter: blur(12px);
position: absolute;
width: 100%;
height: 100%;
background-size: cover;
z-index: -1;
transition: opacity .45s;
opacity: 0;
}
.ripple-container {
position: absolute;
top: 0;
left: 0;
z-index: 1;
width: 100%;
height: 100%;
overflow: hidden;
border-radius: inherit;
pointer-events: none;
}
.animeimg:after {
border-radius: 6px;
position: absolute;
z-index: 1;
width: 100%;
height: 98.5%;
display: block;
left: 0;
top: 0;
content: "";
background: -webkit-linear-gradient(top, rgba(0, 0, 0, .5) 0, rgba(0, 0, 0, .05) 50%, rgba(0, 0, 0, .05) 50%, rgba(0, 0, 0, .5) 100%);
background: linear-gradient(to bottom, rgba(0, 0, 0, .5) 0, rgba(0, 0, 0, .05) 50%, rgba(0, 0, 0, .05) 50%, rgba(0, 0, 0, .5) 100%);
}
.card .card-content {
padding: 15px 30px;
}
.sectit {
padding: 0 !important;
}
.sectit > h6 {
padding-bottom: 10px;
font-size: 12px;
display: none;
}
.text-success {
color: #4caf50;
}
.text-success {
color: #3c763d;
}
.card-blog .card-title {
margin-top: 5px;
}
@media (min-width: 992px)
.sectit > h4 {
width: 60%;
}
.sectit > h4 {
margin-top: 5px !important;
margin-bottom: 5px;
width: 65%;
direction: ltr;
float: left;
font-weight: 700;
font-size: .9rem;
font-family: 'Roboto Condensed';
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.title, .title a, .card-title, .card-title a, .info-title, .info-title a, .footer-brand, .footer-brand a, .footer-big h5, .footer-big h5 a, .footer-big h4, .footer-big h4 a, .media .media-heading, .media .media-heading a {
color: #3C4858;
text-decoration: none;
}
.title, .card-title, .info-title, .footer-brand, .footer-big h5, .footer-big h4, .media .media-heading {
font-weight: 700;
font-family: "Roboto Slab", "Times New Roman", serif;
}
.sectit > h4 > a {
color: #000;
}
.title, .title a, .card-title, .card-title a, .info-title, .info-title a, .footer-brand, .footer-brand a, .footer-big h5, .footer-big h5 a, .footer-big h4, .footer-big h4 a, .media .media-heading, .media .media-heading a {
color: #3C4858;
text-decoration: none;
}
.card .footer {
margin-top: 15px;
}
.episodenumber {
float: right;
margin-top: 8px !important;
font-size: 12px;
}

所以我尝试更改“.card img”中的高度(从自动到 18rem),但图像不再响应。我也尝试设置 min-height 但它也没有用。

这里有两张不同高度的图片:
- /image/Ki247.jpg
- /image/vGjYd.jpg

最佳答案

您需要设置 .card .card-image a 的高度,然后设置 overflow:hidden 以隐藏额外的内容。

.card .card-image a {
display: block;
height: 300px;
overflow: hidden;
border-radius: 10px;
}

堆栈片段

.anime {
margin-bottom: 20px;
background: none !important;
box-shadow: none !important;
}

.card-blog {
margin-top: 30px;
}

.card {
display: inline-block;
position: relative;
width: 100%;
margin-bottom: 30px;
border-radius: 6px;
color: rgba(0, 0, 0, 0.87);
background: #fff;
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 3px 1px -2px rgba(0, 0, 0, 0.2), 0 1px 5px 0 rgba(0, 0, 0, 0.12);
}

.card .card-image {
height: 60%;
position: relative;
z-index: 1;
margin-left: 15px;
margin-right: 15px;
margin-top: -30px;
border-radius: 6px;
}

.animeimg {
margin-left: 0 !important;
margin-right: 0 !important;
}

.timenumber {
z-index: 9999;
font-size: 12px !important;
float: right;
position: absolute;
padding: 8px 10px;
color: #fff;
}

a {
text-decoration: none !important;
}

.card .card-image img {
width: 100%;
border-radius: 6px;
pointer-events: none;
box-shadow: 0 5px 15px -8px rgba(0, 0, 0, 0.24), 0 8px 10px -5px rgba(0, 0, 0, 0.2);
}

.card img {
width: 100%;
height: auto;
}

.card .card-image .colored-shadow {
transform: scale(0.94);
top: 12px;
filter: blur(12px);
position: absolute;
width: 100%;
height: 100%;
background-size: cover;
z-index: -1;
transition: opacity .45s;
opacity: 0;
}

.ripple-container {
position: absolute;
top: 0;
left: 0;
z-index: 1;
width: 100%;
height: 100%;
overflow: hidden;
border-radius: inherit;
pointer-events: none;
}

.animeimg:after {
border-radius: 6px;
position: absolute;
z-index: 1;
width: 100%;
height: 98.5%;
display: block;
left: 0;
top: 0;
content: "";
background: -webkit-linear-gradient(top, rgba(0, 0, 0, .5) 0, rgba(0, 0, 0, .05) 50%, rgba(0, 0, 0, .05) 50%, rgba(0, 0, 0, .5) 100%);
background: linear-gradient(to bottom, rgba(0, 0, 0, .5) 0, rgba(0, 0, 0, .05) 50%, rgba(0, 0, 0, .05) 50%, rgba(0, 0, 0, .5) 100%);
}

.card .card-content {
padding: 15px 30px;
}

.sectit {
padding: 0 !important;
}

.sectit>h6 {
padding-bottom: 10px;
font-size: 12px;
display: none;
}

.text-success {
color: #4caf50;
}

.text-success {
color: #3c763d;
}

.card-blog .card-title {
margin-top: 5px;
}

@media (min-width: 992px) .sectit>h4 {
width: 60%;
}

.sectit>h4 {
margin-top: 5px !important;
margin-bottom: 5px;
width: 65%;
direction: ltr;
float: left;
font-weight: 700;
font-size: .9rem;
font-family: 'Roboto Condensed';
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}

.title,
.title a,
.card-title,
.card-title a,
.info-title,
.info-title a,
.footer-brand,
.footer-brand a,
.footer-big h5,
.footer-big h5 a,
.footer-big h4,
.footer-big h4 a,
.media .media-heading,
.media .media-heading a {
color: #3C4858;
text-decoration: none;
}

.title,
.card-title,
.info-title,
.footer-brand,
.footer-big h5,
.footer-big h4,
.media .media-heading {
font-weight: 700;
font-family: "Roboto Slab", "Times New Roman", serif;
}

.sectit>h4>a {
color: #000;
}

.title,
.title a,
.card-title,
.card-title a,
.info-title,
.info-title a,
.footer-brand,
.footer-brand a,
.footer-big h5,
.footer-big h5 a,
.footer-big h4,
.footer-big h4 a,
.media .media-heading,
.media .media-heading a {
color: #3C4858;
text-decoration: none;
}

.card .footer {
margin-top: 15px;
}

.episodenumber {
float: right;
margin-top: 8px !important;
font-size: 12px;
}

.card .card-image a {
display: block;
height: 300px;
overflow: hidden;
border-radius: 10px;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<div class="container-fluid sec1">
<div class="row">
<div class="col-xs-6 col-md-2 col-lg-2">
<div class="anime card card-blog">
<div class="card-image animeimg">
<div class="timenumber">
<h4>2 دقیقه قبل</h4>
</div>
<a href="#" title="Sword Art Online">
<img class="img" src="/image/Ki247.jpg">
</a>
<div class="colored-shadow" style="background-image: url(&quot;/image/Ki247.jpg&quot); opacity: 1;"></div>
<div class="ripple-container"></div>
</div>

<div class="card-content sectit">
<h6 class="category text-success">در حال پخش</h6>
<h4 class="card-title">
<a href="#" title="Sword Art Online">Sword Art Online</a>
</h4>

<div class="footer episodenumber">
قسمت 13
</div>
</div>
</div>
</div>
<div class="col-xs-6 col-md-2 col-lg-2">
<div class="anime card card-blog">
<div class="card-image animeimg">
<div class="timenumber">
<h4>2 دقیقه قبل</h4>
</div>
<a href="#" title="Sword Art Online">
<img class="img" src="/image/vGjYd.jpg">
</a>
<div class="colored-shadow" style="background-image: url(&quot;/image/vGjYd.jpg&quot;); opacity: 1;"></div>
<div class="ripple-container"></div>
</div>

<div class="card-content sectit">
<h6 class="category text-success">در حال پخش</h6>
<h4 class="card-title">
<a href="#" title="Sword Art Online">Sword Art Online</a>
</h4>

<div class="footer episodenumber">
قسمت 13
</div>
</div>
</div>
</div>
</div>
</div>

关于css - Bootstrap 3 列中图像的高度相同(Material Kit Pro UI),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48783268/

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