Reputation: 33
Good day! I'm designing with my login form right now using CSS and Bootstrap. I want to automatically adjust the height of first div if I adjust the size of the second div. For example, in my second div, I put
. I want my first div will also adjust the size of it.
Code:
<div class="row">
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6" style="background: #1b4d32;">
<p>It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).</p>
</div>
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6" style="background: #000000;">
<form role="form" method="post" action="<?=base_url()?>login/login_submit" class="form-inline justify-content-center text-center">
<br/><br/><br/><br/><br/><br/>
<p id="sign-lbl" style="text-align: center">Please enter your username and<br/>
password to login.</p><br/><br/>
<div class="form-group">
<div class="col-xs-6">
<div class="inner-addon right-addon">
<i class="glyphicon glyphicon-user"></i>
<input type="text" name="username" id="email" class="form-control" placeholder="Username" style="border-radius: 25px;">
</div>
</div>
</div><br/><br/>
<div class="form-group">
<div class="col-xs-6">
<div class="inner-addon right-addon right-addon-1">
<i class="glyphicon glyphicon-lock"></i>
<input type="password" name="password" id="password" class="form-control" placeholder="Password" style="border-radius: 25px;">
</div>
</div>
</div>
<br/><br/>
<span class="button-checkbox">
<button type="button" class="btn" data-color="info">Stay Signed In</button>
<input type="checkbox" name="remember_me" id="remember_me" checked="checked" class="hidden">
</span>
<a href="<?=base_url()?>login/forgotpassword" class="btn btn-link">Forgot Password?</a>
<div class="row" style="margin-top: 35px;">
<div class="col-xs-6 col-sm-6 col-md-6">
<input type="submit" class="btn btn-lg btn-success btn-block" value="Sign In">
</div>
</div>
</form>
</div>
</div>
This is the output:
First div - Green Second div - Black
As you can see they don't have the same height. I want the green one will also adjust the height same of black.
Upvotes: 0
Views: 104
Reputation: 1134
I did it for you: CSS:
.flexbox {
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
}
.flexbox .col {
flex: 1;
position: relative;
}
HTML:
<div class="container">
<div class="row flexbox">
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 col" style="background: #1b4d32;">
<p>It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).</p>
</div>
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 col" style="background: #000000;">
<form role="form" method="post" action="<?=base_url()?>login/login_submit" class="form-inline justify-content-center text-center">
<br/><br/><br/><br/><br/><br/>
<p id="sign-lbl" style="text-align: center">Please enter your username and<br/>
password to login.</p><br/><br/>
<div class="form-group">
<div class="col-xs-6">
<div class="inner-addon right-addon">
<i class="glyphicon glyphicon-user"></i>
<input type="text" name="username" id="email" class="form-control" placeholder="Username" style="border-radius: 25px;">
</div>
</div>
</div><br/><br/>
<div class="form-group">
<div class="col-xs-6">
<div class="inner-addon right-addon right-addon-1">
<i class="glyphicon glyphicon-lock"></i>
<input type="password" name="password" id="password" class="form-control" placeholder="Password" style="border-radius: 25px;">
</div>
</div>
</div>
<br/><br/>
<span class="button-checkbox">
<button type="button" class="btn" data-color="info">Stay Signed In</button>
<input type="checkbox" name="remember_me" id="remember_me" checked="checked" class="hidden">
</span>
<a href="<?=base_url()?>login/forgotpassword" class="btn btn-link">Forgot Password?</a>
<div class="row" style="margin-top: 35px;">
<div class="col-xs-6 col-sm-6 col-md-6">
<input type="submit" class="btn btn-lg btn-success btn-block" value="Sign In">
</div>
</div>
</form>
</div>
</div>
</div>
Here is preview link: https://codepen.io/ziruhel/pen/ZaWdrM
Even if you use bootstrap 4, you can do it without any extra code. please see the link: http://getbootstrap.com.vn/examples/equal-height-columns/
Upvotes: 1
Reputation:
Could you also include your CSS? My tips would be to try and make sure the display is set and try a min-height?
From what I see from your screenshot is, that it is filling 100% of the text containing it, however, do try a min-height
Upvotes: 0