Original
I am new to CSS, how i can make the div stay at the center of the page like this?
Desired
<div class="container">
<div class="row">
<div class="col-md-2">
</div>
<div class="col-md-8 center-block">
<img class="img-responsive" id="MainCharacter" src="../Images/test_character.png" />
</div>
<div class="col-md-2">
</div>
</div>
</div>
Use CSS similar to this:
.container{
position: relative;
}
.row {
position: absolute;
top: 50%;
transform: translateY(-50%);
}
A possible problem is that this code will apply to all .container's and .rows. You could add an id to them and select it using that id.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With