html - Grid elements do not align properly -


i have wordpress website (you can see problem @ duncanhill.com.au)

and if @ website, first 3 property boxes align properly, 4th , 5th weird stuff.

the code looks this:

html:

<div id="grid-gallery" class="grid-gallery"> <section class="grid-wrap">     <ul class="grid">         <li class="grid-sizer"></li><!-- masonry column width -->          <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>             <a href="<?php the_permalink(); ?>">             <li>                  <figure>                     <div class="figimg"><?php the_post_thumbnail(); ?></div>                     <figcaption><h3 class="figtitle"><?php the_title(); ?></h3><p class="price"><?php the_subtitle(); ?></p><p class="figdesc"><?php the_excerpt(); ?></p></figcaption>                 </figure>              </li>             </a>         <?php endwhile; else: ?>             <p><?php _e('sorry, no posts matched criteria.'); ?></p>         <?php endif; ?>     </ul> </section><!-- // grid-wrap --> 

css:

/* general style */ .grid-gallery ul {     list-style: none;     margin: 0;     padding: 0; }  .grid-gallery figure {     margin: 0; }  .grid-gallery figure img/*.figimg*/ {     display: block;     /*width: 100%;     height: 100%;*/     /*height: 210px;*/     border-top-right-radius: 5px;     border-top-left-radius:5px; }  .grid-gallery figcaption h3 {     margin: 0;     padding: 0 0 0.5em; }  .grid-gallery figcaption p {     margin: 0; }   /* grid style */ .grid-wrap {     max-width: 69em;     margin: 0 auto;     padding: 0 1em 1.875em; }  .grid {     margin: 0 auto; }  .grid li {     width: 33%;     float: left;     cursor: pointer; }  .grid figure {      padding: 15px;      -webkit-transition: opacity 0.2s;      transition: opacity 0.2s; }   .grid li:hover figure {      opacity: 0.7; }  .grid figcaption { font-family: 'lato'; font-weight: 300; color: #000000;  padding: 25px; border-left-style: solid; border-right-style: solid; border-bottom-style: solid; border-width: 2px; border-color: #4b91f0; border-bottom-left-radius:5px;  border-bottom-right-radius:5px; }  .figtitle{ font-family: 'lato'; font-weight: 400; }  .figdesc{  }  .price{ font-weight: 400; color: #e74c3c;  } 

i can't work out how fix it! aligning boxes appreciated!

thanks, tom

there 2 things need fix issue, first 1 having html posted.

first, change html code above empty list item class of 'grid-sizer' removed , anchor tags within loop contained within list items. should instead of have:

<div id="grid-gallery" class="grid-gallery"> <section class="grid-wrap">     <ul class="grid">             <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>             <li>                 <a href="<?php the_permalink(); ?>">                     <figure>                         <div class="figimg"><?php the_post_thumbnail(); ?></div>                         <figcaption><h3 class="figtitle"><?php the_title(); ?></h3><p class="price"><?php the_subtitle(); ?></p><p class="figdesc"><?php the_excerpt(); ?></p></figcaption>                     </figure>                 </a>              </li>                         <?php endwhile; else: ?>             <p><?php _e('sorry, no posts matched criteria.'); ?></p>         <?php endif; ?>     </ul> </section><!-- // grid-wrap --> 

second, add following style css:

.grid :nth-child(3n+1) {     clear: left; } 

Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -