Centering objects within the div

2

What is the best way to center objects within a div horizontally and vertically, if it is a responsive div with no fixed size, with width and eight in%. The div is inside a bootstrap row

div class="row" >    div class="col-md-6" >       div class="Here-is-my-div" >

    
asked by anonymous 08.09.2017 / 19:55

2 answers

1

Centralize the DIV by keeping the placements as 0 (zero)

.div {
position:absolute;
border:1px solid black;
margin: auto;
top: 0; left: 0; bottom: 0; right: 0;
}

Centralizing div with bootstrap:

<divclass="row">
    <div class="col-lg-6">Margem</div> 
    <div class="col-lg-6">       
        <div class="col-lg-3">Margem</div> 
        <div class="col-lg-6"> Conteúdo </div> 
        <div class="col-lg-3">Margem</div> 
    </div>
</div> 
    
08.09.2017 / 19:59
0

Using boostrap 4:

<div class="row justify-content-center">
    <div class="col-md-6 text-center">
        --- conteudo -----
    </div>
</div>
    
08.09.2017 / 22:28