我想在另一個div的三個div內居中。我似乎無法得到它的工作。我的網站很敏感,也許這跟它有關係?這裏是我到目前爲止的代碼和CSS,非常感謝任何幫助!圍繞在div內的三個div
我想有三個div的中心內.home-highlights
.hp-highlight
:
<div id="home-highlights" class="clearfix">
<div class="heading">
<h2><a href="http://kompufast.com/?page_id=1909" title="What We Do"><span>What We Do</span></a></h2>
</div>
<!-- /heading -->
<div class="hp-highlight ">
<img src="http://kompufast.com/wp-content/uploads/2012/06/kompufast_sales1.jpg" title="Sales" class="hp-highlight-img" />
<h3><a href="http://kompufast.com/?services=safe-computing" title="Sales" target="_self">Sales</a></h3>
<p>KompuFAST+ is the right company to help you address your need for all kind of consumer technology products.</p>
</div>
<!-- /hp-highlight -->
<div class="hp-highlight ">
<img src="http://kompufast.com/wp-content/uploads/2012/02/kompufast_order1.jpg" title="Order" class="hp-highlight-img" />
<h3><a href="http://kompufast.com/?services=social-media" title="Order" target="_self">Order</a></h3>
<p>KompuFAST-Order facilitates the ordering of products, without a fee for special order.</p>
</div>
<!-- /hp-highlight -->
<div class="hp-highlight highlight-third ">
<img src="http://kompufast.com/wp-content/uploads/2012/02/kompufast_fix1.jpg" title="Fix" class="hp-highlight-img" />
<h3><a href="http://kompufast.com/?services=shared-hosting " title="Fix" target="_self">Fix</a></h3>
<p>KompuFAST+ has a team of dedicated repair technicians ready to diagnose your computer for all sorts of problems.</p>
</div>
這是我一直在努力的CSS:
.home-highlights {
margin-right:auto;
margin-left:auto;
width: 100%;
}
.hp-highlight {
width: 280px;
}
我剛剛寫了一個解決你的目標的[** SO Answer **](http://stackoverflow.com/a/11588894/1195891)。此外,請檢查部分***選擇你的味道***在我的其他答案[** HERE **](http://stackoverflow.com/a/11516162/1195891)瞭解更多的想法。乾杯! – arttronics 2012-07-21 02:14:45