我有这样的代码:
<div style="position:relative">
<div style="float:left; width: 183px; background-color:#c1cba9; color: #000000;"><img border="0" alt="Product categories" title="Product categories" src="http://www.gvcdigital.co.uk/images/graphic/categrieshead.png" width="179" height="43"><br />
<div style="margin-left: 10;"><ul><li><a href="/Digi-Spot/Sound-Vision-/_i.html?_sacat=293&_sid=560455030&_trksid=p4634.c0.m322">Sound & Vision</a><span class="cnt"> (9943)</span></li><ul class="lev2"><li><a href="/Digi-Spot/TV-Home-Audio-Accessories-/_i.html?_sacat=14961&_sid=560455030&_trksid=p4634.c0.m322">TV & Home Audio Accessories</a><span class="cnt"> (4056)</span></li><li><a href="/Digi-Spot/Performance-DJ-Equipment-/_i.html?_sacat=48458&_sid=560455030&_trksid=p4634.c0.m322">Performance & DJ Equipment</a><span class="cnt"> (1893)</span></li><li><a href="/Digi-Spot/Multipurpose-Batteries-Power-/_i.html?_sacat=48446&_sid=560455030&_trksid=p4634.c0.m322">Multipurpose Batteries & Power</a><span class="cnt"> (1571)</span></li></ul><li class="morelnk"><a href="/Digi-Spot/Sound-Vision-/_i.html?_sacat=293&_sasi=1&_sid=560455030&_trksid=p4634.c0.m322">more...</a></li><li><a href="/Digi-Spot/Business-Office-Industrial-/_i.html?_sacat=12576&_sid=560455030&_trksid=p4634.c0.m322">Business, Office & Industrial</a><span class="cnt"> (2530)</span></li><ul class="lev2"><li><a href="/Digi-Spot/Building-Materials-Supplies-/_i.html?_sacat=41498&_sid=560455030&_trksid=p4634.c0.m322">Building Materials & Supplies</a><span class="cnt"> (2168)</span></li><li><a href="/Digi-Spot/Electrical-Test-Equipment-/_i.html?_sacat=92074&_sid=560455030&_trksid=p4634.c0.m322">Electrical & Test Equipment</a><span class="cnt"> (107)</span></li><li><a href="/Digi-Spot/Industrial-Tools-/_i.html?_sacat=64808&_sid=560455030&_trksid=p4634.c0.m322">Industrial Tools</a><span class="cnt"> (92)</span></li></ul><li class="morelnk"><a href="/Digi-Spot/Business-Office-Industrial-/_i.html?_sacat=12576&_sasi=1&_sid=560455030&_trksid=p4634.c0.m322">more...</a></li><li><a href="/Digi-Spot/Computers-Tablets-Networking-/_i.html?_sacat=58058&_sid=560455030&_trksid=p4634.c0.m322">Computers/Tabl​ets & Networking</a><span class="cnt"> (1655)</span></li><ul class="lev2"><li><a href="/Digi-Spot/Cables-Connectors-/_i.html?_sacat=31491&_sid=560455030&_trksid=p4634.c0.m322">Cables & Connectors</a><span class="cnt"> (1328)</span></li><li><a href="/Digi-Spot/Laptop-Desktop-Accessories-/_i.html?_sacat=31530&_sid=560455030&_trksid=p4634.c0.m322">Laptop & Desktop Accessories</a><span class="cnt"> (262)</span></li><li><a href="/Digi-Spot/Other-Computing-Networking-/_i.html?_sacat=162&_sid=560455030&_trksid=p4634.c0.m322">Other Computing & Networking</a><span class="cnt"> (33)</span></li></ul><li class="morelnk"><a href="/Digi-Spot/Computers-Tablets-Networking-/_i.html?_sacat=58058&_sasi=1&_sid=560455030&_trksid=p4634.c0.m322">more...</a></li></ul><div class="link"><br><a href="/Digi-Spot/_i.html?_sasi=1&_sid=560455030&_trksid=p4634.c0.m322">See all items in the store</a></div></div><br />
<img border="0" src="http://www.gvcdigital.co.uk/images/graphic/catbot.png" width="179" height="17"></div>
<div style="float:left; width: 480px; height:100px; text-align: center; background-color:#d6d6a4;"><img border="0" src="http://www.gvcdigital.co.uk/images/graphic/description.png" width="232" height="81"><br /><div style="text-align: left; margin-left: 10;">[[Description]]</div></div>
<div style="float:left; width: 324px; height:100px; text-align: center; ">
<div style="width: 324px; color: #ffffff; background-color:#6b8861; background-color:#d6d6a4;font-size : 34px;">[[Title]]</div>
<div style="width: 324px; color: #ffffff; background-color:#6b8861;"><div style="width: 320px; margin: 2 2 2 2; background-color:#ffffff;">[[Picture1]]</div><div style="width: 300px; height: 2px; background-color:#6b8861; color: #6b8861;"></div></div>
<div style="width: 324px; color: #801010; font-size : 40px; background-color:#d6d6a4;">Price: [[BuyItNowPrice]]</div>
</div>
</div>
<div style="clear: both; text-aling: center; width:985px;"><img border="0" src="graphic/buttom.png" width="524" height="42"></div>
结果看起来像这样:
可能是什么问题?我希望红色div中标记的位于底部的中心。
答案 0 :(得分:3)
将margin: 0 auto
添加到该div:
<div style="clear: both; text-align: center; width:985px; margin: 0 auto;"><img border="0" src="graphic/buttom.png" width="524" height="42"></div>
答案 1 :(得分:2)
在最后一个div中,您有text-aling: center
而不是text-align: center
。
答案 2 :(得分:1)
添加保证金:0自动;到那个标记的div。
答案 3 :(得分:1)
您已将text-aling:center
设为text-align:center
。修复它你会得到图像位于div的中心。要将div本身居中,请将margin: 0 auto
添加到该div
演示:http://jsfiddle.net/8p7A2/1/同时添加了固定文本对齐和边距。