我被卡住了。這是我正在做的事情,我在網頁上的主圖像旁邊有一個AddThis共享窗口小部件。圖像更改大小,我需要AddThis以動態更改其與圖像的位置。我在another question問過這個問題,通過另一個論壇我可以得到一些幫助。現在AddThis和圖像對齊正確,一切似乎都朝着正確的方向,但圖像不再居中。我需要這個圖像集中在頁面上,但我不知道如何做到這一點,因爲我不得不浮動包含圖像和AddThis的div。這裏是HTML:居中浮動div
<div class="feature-container">
<div style="min-height:100px; min-width:100px; position:relative; float:left; ">
<div style="text-align:center;"><img class="feature-image"
src="/Images/test.jpg" width="300px;" alt="test" /></div>
<div style="position:absolute; bottom:0px; right:-40px;">
<div class="addthis_toolbox addthis_floating_style addthis_16x16_style">
<a class="addthis_button_facebook"></a>
<a class="addthis_button_twitter"></a>
<a class="addthis_button_email"></a>
<a class="addthis_button_compact"></a>
</div>
<script type="text/javascript" src="http://s7.addthis.com/js/300
/addthis_widget.js"></script>
</div>
</div>
</div>
任何想法如何居中?我可以使用直接的CSS解決方案或使用jQuery和CSS的解決方案。請提供例子。
Here is a page這是我嘗試使用的最新代碼。
_ 「我不得不浮動DIV」 _ - 爲什麼?我不知道如果沒有看到一些周圍的元素,我可以提出任何建議。 – nnnnnn
@nnnnnn - 這是AddThis的行事方式。爲了使它相對於圖像的位置,它必須被漂浮。 – L84
你能提供[jsfiddle](http://jsfiddle.net)上的示例嗎? – undefined