html - Center two divs floated left inside parent container -


i have been trying solve hours no luck. trying center wordpress masonry style gallery , can not life of me work. have looked on internet trying find out how no luck. want images centered inside parent container let's parent container 1000px wide , entire gallery 300px wide. instead of being left aligned want in center.

there several nested div's , have tried apply inline-block them , text-align: center parent div along several other combinations. have given , tell me going wrong.

i have included fiddle , source code below. if helps here theme , gallery using. simple article theme help.

<div class="main-container">     <div class="gdlr-shortcode-wrapper">         <div class="gdlr-gallery-grid gdlr-item">         <div class="gdlr-gallery-grid-container">             <div class="gallery-grid-first">                 <div class="gallery-grid-first-inner"> <a href="#">                     <img src="http://placekitten.com/240/300">                 </a>                  </div>             </div>             <div class="gallery-grid-second">                 <div class="gallery-grid-second-inner"> <a href="#">                     <img src="http://placekitten.com/240/302">                 </a>                  </div>                 <div class="gallery-grid-second-inner"> <a href="#">                     <img src="http://placekitten.com/242/305">                 </a>                  </div>             </div>         </div>                 </div>     </div> </div> 

css:

.main-container {     width: 100%;     text-align: center;     margin: 0 auto; }  .gdlr-shortcode-wrapper {     margin-left: -15px;     margin-right: -15px; } .gdlr-gallery-grid.gdlr-item {     margin: 0px 13px; } .gdlr-gallery-grid.gdlr-item .gallery-grid-first {     width: 33.33%;     float: left;     display: inline-block; } .gdlr-gallery-grid.gdlr-item .gallery-grid-first-inner {     margin: 0px 2px 4px; } .gdlr-gallery-grid.gdlr-item .gdlr-gallery-grid-container img {     display: block; } .gdlr-gallery-grid.gdlr-item .gallery-grid-second-inner {     margin: 0px 2px 4px; } .gdlr-gallery-grid.gdlr-item .gallery-grid-second {     width: 33.33%;     float: left;     display: inline-block; } img {     vertical-align: middle; } 

**no need use float property display inline-block. used general class grid inner , gallery-grid** <div class="main-container">     <div class="gdlr-shortcode-wrapper">         <div class="gdlr-gallery-grid gdlr-item">             <div class="gdlr-gallery-grid-container">                 <div class="gallery-grid-first gallery-grid">                     <div class="gallery-grid-first-inner gallery-grid-inner">                         <a href="#"><img src="http://placekitten.com/240/300"></a>                     </div>                 </div>                 <div class="gallery-grid-second gallery-grid">                     <div class="gallery-grid-second-inner gallery-grid-inner">                         <a href="#"><img src="http://placekitten.com/240/302"></a>                     </div>                     <div class="gallery-grid-second-inner gallery-grid-inner">                         <a href="#"><img src="http://placekitten.com/242/305"></a>                     </div>                 </div>             </div>         </div>     </div> </div> 

Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -