ボタンの幅に関係なく、ボタンを赤い領域の中央に配置する方法を誰かが説明できますか?
ここに私のデモがあります: http://jsfiddle.net/v3X2k/
そして、ここに私のコードがあります:
<div style="width:660px;height:40px;display;block;background:red">
<div id="wrapper3" style="margin:0 auto;width:160px">
<button>Test</button>
<button>Test 2</button>
</div>
</div>
<hr />
<div style="width:660px;height:40px;display;block;background:red">
<div id="wrapper3" style="margin:0 auto;width:160px">
<button>Test Test Test Test Test Test</button>
<button>Test 2</button>
</div>
</div>
2 番目の例でわかるように、2 番目のボタンは下にドロップしますが、実際には上のボタンのようにインラインのままにしたいのです。
ステートメントを削除してよかったのですwidth:160px
が、これらのボタンを中央に配置する必要があるだけです。
何か案は?
どうもありがとう :)