Siddharth
Siddharth

Reputation: 893

Moving a block to center using css

I have a section in my rails web application's view page which is nothing but a code that's displaying the facebook like, twitter tweet and other sharing options. The code goes like this:-

<!-- AddThis Button BEGIN -->
<div class="addthis_toolbox addthis_default_style ">
<a class="addthis_button_facebook_like" fb:like:layout="button_count"></a>
<a class="addthis_button_tweet"></a>
<a class="addthis_button_pinterest_pinit"></a>
<a class="addthis_counter addthis_pill_style"></a>
</div>
<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-50effbad1fc26ade"></script>
<!-- AddThis Button END -->

I wanted to move this div to center. So my css code for this is like:

 .center {
text-align: center;
}

And I then added the <div class="center"> to my code...

But it's node moving everything center. What could be the reason??

Thanks in advance...

Upvotes: 1

Views: 527

Answers (1)

sadaf2605
sadaf2605

Reputation: 7540

try puting a value to the width of your .center! For your convenience you can use a background color to keep your eyes on different div s what difference it makes.

.center {
text-align: center;
width: 70%

/*For the sake of understanding divs sometimes background color helps*/
background-color:#b0e0e6;

}

Upvotes: 1

Related Questions