htmlcssaddthissquarespace

Center AddThis Inline Follow Buttons div


I am trying to center the AddThis inline follow buttons. By default they left align.

The code for the follow buttons is:

<!-- Go to www.addthis.com/dashboard to customize your tools -->
<div class="addthis_inline_follow_toolbox"></div>

I tried adding them within a div like so:

<div class="center_aift">
<!-- Go to www.addthis.com/dashboard to customize your tools -->
<div class="addthis_inline_follow_toolbox"></div>
</div>

I added the following CSS but it made no difference, they still align to the left.

.center_aift {
    width: 100%;
    text-align: center;
}

I am using SquareSpace with a custom code block but do not think that is the problem.


Solution

  • I asked above about checking the DOM tree for styles causing the left align, like a float on the buttons. Given your example, there is a float on the buttons. The exact CSS is:

    .addthis_default_style .addthis_separator,
    .addthis_default_style .at4-icon, 
    .addthis_default_style .at300b,
    .addthis_default_style .at300bo, 
    .addthis_default_style .at300bs,
    .addthis_default_style .at300m {
        float: left;
    }
    

    Overwrite that style with float: none; and then add text-align: center; to the parent div container which has the classes addthis_toolbox addthis_default_style. The buttons will then center.