gpt4 book ai didi

css - card-img-top 和 card-body 之间的边框

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

我想在 Bootstrap 卡中的图像和卡体之间有一个边框。我有一个 CSS 如下-

.card{
border-width: 6px;
border-color: rgb(255, 255, 255);
border-radius: 0;
background-color: transparent;
}

.card-body{
border-top-width: 5px;
border-top-color: rgb(255, 255, 255);
border-radius: 0;
color: rgb(255, 255, 255);
text-align: center;
}

HTML-

<div class="col-md-4">
<div class="card">
<img class="card-img-top" alt="Depression" src="images/depression.jpg">
<div class="card-body">
<h3 class="card-title">DEPRESSION</h3>
<p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
</div>
</div>
</div>

我想要什么-

Card design I want

我得到了什么-

Card design I'm Getting

感谢所有帮助,谢谢。

最佳答案

必须使用边框样式才能使用边框。如您所见here :

Note: None of the OTHER CSS border properties described below will have ANY effect unless the border-style property is set!

所以你可以试试这个代码:

.card-body{
border-top-width: 5px;
border-top-color: rgb(255, 255, 255);
border-top-style:solid;
border-radius: 0;
color: rgb(255, 255, 255);
text-align: center;
}

或者简单地这样做:

.card-body{
border-top: 5px solid rgb(255, 255, 255);
border-radius: 0;
color: rgb(255, 255, 255);
text-align: center;
}

关于css - card-img-top 和 card-body 之间的边框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47485377/

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