[英]Why do I have a column dependent on another using Bootstrap 4?
I have a problem with my web application.我的 web 应用程序有问题。
Explanation: The longer the text displayed on the left (so another column), the larger the image.解释:左边显示的文字越长(所以另一列),图像越大。 So how can I get one column completely independent from another?
那么我怎样才能让一列完全独立于另一列呢?
<section class="section">
<div class="container">
<div class="row">
<div class="col-md-6 col-sm-4 col-xs-4 p-4">
<h1>nosfera.app</h1>
<p>Oops, I think you got lost in the humble abode of Nosfera.
<p>But don't worry ! We will take care of you, you will be treated like a king, and soon everyone will
notice you, but for that, you have to join the dark side by clicking one of the two little buttons
below.
<div class=fields>
<div class=item><a href=/login><button class="btn btn-red">Log in</button></a></div>
<div class=item><a href=/login><button class="btn btn-grey ml-2">Register</button></a></div>
</div>
</div>
<div class="col-md-6 col-xs-4 col-sm-4">
<div class="block"></div>
</div>
</div>
</div>
</section>
.section {
display: grid;
height: 90vh;
align-content: center;
}
.section p {
font-weight: 400;
font-size: 1.2rem;
}
.block {
background:url(../img/block.png);
background-size:contain;
background-repeat:no-repeat;
background-position:center;
width:100%;
height:100%
}
You are applying height:100%
on the .block
element CSS.您在
.block
元素 CSS 上应用height:100%
。 It will grows with the text.它会随着文本增长。 Just set an fixed size (100px for instance), or limit the
max-height
and it will stop growing只需设置一个固定大小(例如 100 像素),或限制
max-height
,它将停止增长
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.