嗨我想中心在div中的4個圖像。正如你所看到的,他們被困在左邊。將div中的內容居中。保證金0,自動不起作用。也沒有顯示:內嵌
我想他們是完全中心與至少圍繞它們一個5-10px餘量理由(略向右移動)。 這只是我關心的這個部分...而不是HTML網站的其餘部分。謝謝。 我的HTML是:
<section id="slide-6" class="homeSlide">
<div class="bcg">
<div class="hsContainer">
<!-- <div class="hsContent">-->
<div class="img">
<a target="_blank" href="">
<img src="http://fieldtelecommunications.com/images/telecommunications_equipment.jpg" alt="Klematis" width="280" height="280">
</a>
</div>
<div class="img">
<a target="_blank" href="">
<img src="http://fieldtelecommunications.com/images/telecommunications_equipment.jpg" alt="Klematis" width="280" height="280">
</a>
</div>
<div class="img">
<a target="_blank" href="">
<img src="http://fieldtelecommunications.com/images/telecommunications_equipment.jpg" alt="Klematis" width="280" height="280">
</a>
</div>
<div class="img">
<a target="_blank" href="">
<img src="http://fieldtelecommunications.com/images/telecommunications_equipment.jpg" alt="Klematis" width="280" height="280">
</a>
</div>
</div>
</div>
</div>
</section>
CSS是:
#slide-6 .bcg {
position: relative;
background-color: #efefef;
height:50%;
}
slide-6 .hsContent {
position: relative;
}
slide-6 .hscontainer {
width: 100%;
height: 100%;
display:inline;
overflow: hidden;
margin: 0 auto; position: relative;
}
div.img {
margin: 20px;
/*padding: 5px;*/
/*border: 1px solid #0000ff;*/
/*height: auto;
width: auto;*/
/*float: left;*/
display:inline;
}