Search code examples
jqueryhtmlcsstwitter-bootstrap-2

How to center a div with Bootstrap


how can i center a div that is inside span7 so that span7 and span5 both will display in same line.I am using bootstrap 2.3.2

this is my code jsfiddle

<div class="row-fluid">
                <!-- 1st Column -->
    <div class="span7">
         <div id="imagediv" style="position: relative;">
             <img src="" style="z-index: 0;" >
         </div>           
    </div>
                <!-- END 1st Column -->


                <!-- 2nd Column -->

    <div class="span5">
        <div>
            <p class="well" style="min-height: 440px; word-wrap: break-word;"> Profile Info </p>
        </div>   
    </div>

          <!-- End 2nd Column -->
</div>

How can i make imagediv into center of span7


Solution

  • Add text-center class to the div

    <div class="span7 text-center">
         <div id="imagediv" style="position: relative;">
             <img src="http://s25.postimg.org/scg5jg3rf/profile.jpg" style="z-index: 0;" />
         </div>           
    </div>
    

    working jsfiddle http://jsfiddle.net/aCD89/3/

    screenshot output:

    screenshot