Center Bootstrap Row and Spans

主宰稳场 提交于 2019-12-08 00:37:07

问题


I'm trying to center a Row and the spans inside of it with bootsrap.

You can see it in the footer here: http://www.divisionforty.com/wall/

I'd like the social networking icons to be on the left, copyright in the middle the powered by on the right, as it all is.

footer code:

<div id="footer">

        <div id="footer-content">


                <div id="footer-bottom" class="clear">



                      <div class="row" style="margin: 0 auto;">
<div class="span12" style="width:100%;">
<div class="span2" style="text-align:left;">
<a href="https://twitter.com/WallSpaceOttawa"><img alt="twitter" class="social" src="<?php bloginfo('stylesheet_directory'); ?>/img/twitter.png"></a>
<a href="https://www.facebook.com/pages/Wall-Space-Gallery-and-Framing/195974620432391"> 
<img alt="facebook" class="social" src="<?php bloginfo('stylesheet_directory'); ?>/img/facebook.png"></a>
</div>

<div class="span6" style="text-align:center;">

<h5>
  Copyright &#169; <script type="text/javascript">
//<![CDATA[
                                    var dteNow = new Date();
                                    var intYear = dteNow.getFullYear();
                                    document.write(intYear);
          //]]>
          </script>
          Wall Space Gallery And Framing - All Rights Reserved.

</h5>
</div>

<div class="span4" style="text-align:right;">
<h5>Powered by <a href="http://divisionforty.com">Division Forty</a></h5>
</div>
</div>

</div>


                </div><!--END FOOTER-BOTTOM-->    

        </div><!--END FOOTER-CONTENT-->        

    </div><!--END FOOTER-->

Hope someone can help.

Thanks

Denver


回答1:


<div id="footer">

        <div id="footer-content">


                <div id="footer-bottom" class="clear">



                      <div class="row" style="margin: 0 auto;">
<div class="span12" style="width:100%;">
<div class="span2 text-left">
<a href="https://twitter.com/WallSpaceOttawa"><img alt="twitter" class="social" src="<?php bloginfo('stylesheet_directory'); ?>/img/twitter.png"></a>
<a href="https://www.facebook.com/pages/Wall-Space-Gallery-and-Framing/195974620432391"> 
<img alt="facebook" class="social" src="<?php bloginfo('stylesheet_directory'); ?>/img/facebook.png"></a>
</div>

<div class="span6 text-center">

<h5>
  Copyright &#169; <script type="text/javascript">
//<![CDATA[
                                    var dteNow = new Date();
                                    var intYear = dteNow.getFullYear();
                                    document.write(intYear);
          //]]>
          </script>
          Wall Space Gallery And Framing - All Rights Reserved.

</h5>
</div>

<div class="span4 text-right">
<h5>Powered by <a href="http://divisionforty.com">Division Forty</a></h5>
</div>
</div>

</div>


                </div><!--END FOOTER-BOTTOM-->    

        </div><!--END FOOTER-CONTENT-->        

    </div><!--END FOOTER-->

You can use the built in alignment classes text-left, text-right, and text-center




回答2:


Is it your design to let footer full width as screen width?

if yes, you just have to change your row class to row-fluid class. Bootstrap 2.3.2 is using row-fluid, not row.

<div id="footer">
     <div id="footer-content">
          <div id="footer-bottom" class="clear">
                  <div class="row-fluid" style="margin: 0 auto;">
    <div class="span12" style="width:100%;">

        <div class="span2 text-left">
        </div>

        <div class="span6 text-center">
        </div>

        <div class="span4 text-right">
        </div>
    </div>
</div>
            </div><!--END FOOTER-BOTTOM-->    
    </div><!--END FOOTER-CONTENT-->        
</div><!--END FOOTER-->

if no, put a container for the width.



来源:https://stackoverflow.com/questions/19040301/center-bootstrap-row-and-spans

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!