【发布时间】:2020-10-02 12:32:06
【问题描述】:
我将图像放置在页面的中心,并将其上的文本放置在中间。但图像看起来很小。如何在 bootstrap 中调整其宽度和高度?
.inner {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background-color: rgba(0, 0, 0, 0.3);
color: #fff;
padding: 30px;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js"></script>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container">
<div class="img-text-container">
<img src="https://dummyimage.com/600x400/000/fff&text=+" class="img-fluid max-width:100%
height:auto" alt="Responsive image">
<div class="text-center bg-text inner">
<h1> acknowledge Nature! </h1>
<p>Nature is the most important thing in the life
which is alive.</p>
</div>
</div>
</div>
【问题讨论】:
标签: html css image twitter-bootstrap size