在引导程序中减小卡头的宽度



我的页面中有一个卡布局,我想在其中减少引导卡布局的卡头宽度。

我尝试使用的margin属性,但它减少了但没有减少整个div,它更改了卡头div内的值。

<div class="card card-nav-tabs text-center grid-selection">
<div class="card-body custom-card-body">
<h5 class="card-text">ARCADE</h5>
</div>
<div class="card-footer text-muted custom-game-subtitle" id="arcade">
<div class="custom-subtitle-text">
Learn the Synonyms while you play.
</div>
<div class="custom-loading-svg" style="display:none">
<img src="img/loading.svg">
</div>
</div>
<!-- </a> -->
</div>
</div>

如何减少卡头的整个div?

JSFiddle

您可以将自己的样式规则添加到Bootstrap元素中,只需确保先将Bootstrap样式放入,然后将自己的自定义样式放入HTML的头部即可。

你也可以使用这个:

<div class="card" style="width: 18rem;">

以下是一个可能有所帮助的示例。

<div class="card" style="width: 18rem;">
<img class="card-img-top" src="..." alt="Card image cap">
<div class="card-body">
<h5 class="card-title">Card title</h5>
<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>
<a href="#" class="btn btn-primary">Go somewhere</a>
</div>

您必须更改html结构。查看更新的小提琴https://jsfiddle.net/aq9Laaew/118712/

<div class="container">
<div class="row">
<div class="col">
1 of 2
</div>
<div class="col">
2 of 2
</div>
</div>
<div class="row">
<div class="col">
<div class="custom-card-body" style="width: 30%; background: red; margin: auto">
<h5 class="card-text">ARCADE</h5>
</div>
<div class="card card-body card-nav-tabs text-center grid-selection">
<div class="card-footer text-muted custom-game-subtitle" id="arcade">
<div class="custom-subtitle-text">
Learn the Synonyms while you play.
</div>
<div class="custom-loading-svg" style="display:none">
<img src="img/loading.svg">
</div>
</div>
<!-- </a> -->
</div>
</div>
</div>
</div>

最新更新