无法将div框与中心对齐

时间:2016-10-10 17:05:18

标签: html css wordpress

我正在开发此网站:www.sfitnesscenter.com

我试图让滑块下方的4个框水平对齐2到2的中心位置。我尝试过使用保证金:自动,但没有任何改变。

这里是html

<section id="wrapsecond">
  <div class="container">
    <div class="services-wrap">
      <?php if( get_theme_mod('shortinfo_sb') ) { ?>
        <?php echo get_theme_mod('shortinfo_sb'); ?>
      <?php } else { ?>                      
        <?php echo '<h2>What We Do</h2>
        <p>We are passionate about our clients results.</p>'; } ?>
        <div class="space50"></div>

<!-- Home Boxes Section -->
      <div class="home_boxes">
      <?php
        for($bx=1; $bx<5; $bx++) { 
          if( get_theme_mod('page-setting'.$bx)) { 
            $bxquery = new WP_query('page_id='.get_theme_mod('page-setting'.$bx,true)); 
         while( $bxquery->have_posts() ) : $bxquery->the_post(); 
                        ?>
         <div class="one_third <?php if($bx%4==0){ ?>last_column<?php } ?>">
           <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail(); ?>
           <h4><?php the_title(); ?></h4><?php echo fitnesslite_content(22); ?>
           <span class="ReadMore"><?php _e('Read More','fitness-lite');?>   </span>
           </a>
         </div>
         <?php endwhile; }else{?>

          <div class="one_third <?php if($bx%4==0){ ?>last_column<?php } ?>">
          <a href="#"><img src="<?php echo get_template_directory_uri(); ?>/images/thumb_0<?php echo $bx; ?>.jpg"><h4><?php _e('Page Title','fitness-lite'); ?><?php echo $bx; ?></h4><p><?php _e('Phasellus viverra aliquet magna quis interduming. Sed quis fringilla massa. In ut porttitor felis necing iaculis mi. Proin tempo...','fitness-lite');?></p><span class="ReadMore"><?php _e('Read More','fitness-lite');?></span>
</a></div>                        

          <?php }}?>
        </div>
        <!-- Home Boxes Section -->
      </div><!-- services-wrap-->
    <div class="clear"></div>
  </div><!-- container -->
</section><div class="clear"></div>

这里是css

/* = Services section css
-------------------------------------------------------------- */
#wrapsecond{ background-color:#272727; color:#fff; padding-bottom:100px; }
.services-wrap, #FrontBlogPost .BlogPosts{ visibility:hidden;}

.one_third{ margin:0 5% 3.5% 0; float:left; padding:25px; border:2px solid #fff;}
.one_third:hover{ border-color:#ff4e1c;}
.one_third:hover .ReadMore{ background-color:#ff4e1c;}

.one_third img{ width:100%;}
.one_third h4{font:600 18px/22px 'Roboto',sans-serif;  padding:20px 0; margin:0; text-transform:uppercase; color:#fff;}
.one_third h4 span{ color:#ff4e1c; font-weight:300;}

.one_third h4 span::after{content:" ________"; display:inline-block;}


.one_third p{ margin-bottom:20px; color:#fff;}
.last_column{clear:right; margin-right:0 !important; }

@media (max-width: 992px) {
    .one_third { min-width: 45% }
}

@media (min-width: 992px) {
    .one_third { max-width: 40% }
}

#wrapsecond h2{ font-size:40px; color:#fff; font-weight:600; margin-bottom:0; text-transform:uppercase; }
#wrapsecond h2 span{ color:#ff4e1c; font-weight:300; }

NB: 实际上,布局应该是这样的 左上角:有氧健身班, 右上:肚皮舞班, 左下:瑜伽课, 右下:尊巴舞班

它是水平和垂直平行的,直到我的客户前几天放了内容。即使在删除照片后也没有任何改变。所以,我不认为这是由那些照片的尺寸引起的

1 个答案:

答案 0 :(得分:0)

将框的Looks like you installed react-native globally, maybe you meant react-native-cli? To fix the issue, run: npm uninstall -g react-native npm install -g react-native-cli 更改为display并稍微减少inline-block。并删除margin。 将float课程更改为以下

.one_third

避免使用花车。处理它是一件麻烦事。