【发布时间】:2019-07-09 18:02:34
【问题描述】:
我正在使用引导卡https://getbootstrap.com/docs/4.0/components/card/ 显示图像,问题出在引导模板上它只是添加了一个边距,如果有人有解决方案,我只想让图像保持 div 的全宽不胜感激,提前致谢。
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
<!-- card documentation https://getbootstrap.com/docs/4.0/components/card/ -->
<section >
<div class="card text-center">
<div class="card-header" style="background-color:white">
Card Header
<div class="card-body">
<center>
<!-- img I need full page size on card body -->
<div class="view overlay zoom">
<img src="https://mdbootstrap.com/img/Photos/Horizontal/Nature/6-col/img%20(131).jpg" class="img-fluid " alt="smaple image">
</div> </center>
<p class="card-text">card description</p>
<div class="card-footer text-muted" style="background-color: white">card footer</div>
</section>
【问题讨论】:
-
"保持 div 的全宽"。你指的是哪个div?
<div class="view overlay zoom" />还是<div class="card" />?顺便说一句,在您的 HTML 布局中,.card-body嵌套在.card-header中。 -
div 是 ''
<div class="card-body" />有默认的 1.25 rem 填充(不是边距)。您不关心填充,只希望图像绝对 100% 宽度,或者您确实想要容纳填充?是的,如何容纳填充?
标签: html css twitter-bootstrap bootstrap-4