html - Horizontally & Vertically centering 2 divs within two side by side 50% width columns -


having trouble getting 2 divs center horizontally & vertically within respective parents side side 50% width , 100% height.

here's i've got (codepen ease).

codepen link

*** html *** <div class="parent">   <div class="left">     <div class="info">       <h1>this div should centered <br>within left 50%</h1>       <h2>get in touch:</h2>       <h1>         +44 (0)1323 567 891<br>         +44 (0)1323 132 363<br>         info@somecompany.co.uk<br>       </h1>     </div>   </div>    <div class="right">     <div class="img-wrapper">       <img src="http://placehold.it/210x210/fe5000/fff"/>     </div>   </div> </div  *** css *** .parent {   height: 100%;   width: 100%; }  .parent:before, .parent:after {   display: table;   content: " ";  }  .parent:after {   clear: both; }  .left, .right {   float: left;   height: 100%;   width: 50%; }  .info {   width: 400px;   height: 280px;   top: 0;   right: 0;   bottom: 0;   left: 0;   margin: auto; }  .right .img-wrapper {   width: 210px;   height: 210px;   top: 0;   right: 0;   bottom: 0;   left: 0;   margin: 0 auto; } 

i tried this. i'm not sure if looking for. added display: flex; .left , .right classes.

.parent {     height: 100%;     width: 100%; }  .left, .right {     float: left;     height: 500px;     width: 50%;     display: flex; }  .info {     width: 400px;     height: 280px;     top: 0;     right: 0;     bottom: 0;     left: 0;     margin: auto; } 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -