对已自行调整大小的div进行故障诊断

时间:2015-04-13 13:09:33

标签: html css css3 dimensions

我目前正在构建div网格布局网页。显然,我一直在编辑每个方格以填补角色。但是出于某种原因,我注意到虽然我已经将大多数div指定为200x200px,而且由于某种原因,其中一些是200x400px,因此其中一些已经通过额外的10px进行了调整,因此正方形开始重叠。我之前没有遇到过这个问题。有人可以解决这个问题吗?因为我看不出问题。

问题在于“步骤”div和“特别优惠”div,其中背景也调整为一半大小。 Here is a livelink to the page in question, please look at the source code. I shall remove this when the question is answered for future posterity of the post.

这是HTML:

<div class="col">
    <div class="trigger">
        <div style="display:table-cell; vertical-align:middle; color: white;" tabindex="0" class="maincontent hover-img img4"><img src="STEP1.jpg" height="200" width="200"/><p style="margin: 10px 20px;">Fill out our order form choosing the service you require and your payment details. We will then take a deposit and book you into our diary.<p></div>
    </div>
    <div class="trigger">
        <div style="display:table-cell; vertical-align:middle; color: white;" tabindex="0" class="maincontent hover-img img4"><img src="STEP3.jpg" height="200" width="200"/><p style="margin: 10px 20px;">We will produce the work you require using the project plan. All of our work is produced Within the time limit set and to the highest possible standard.<p></div>
    </div>
</div>
<div class="col">
    <div class="trigger">
        <div style="display:table-cell; vertical-align:middle; color: white;" tabindex="0" class="maincontent hover-img img4"><img src="STEP2.jpg" height="200" width="200"/><p style="margin: 10px 20px;">We will have a face to face meeting to discuss everything that you require and we will put together a project plan.<p></div>
    </div>
    <div class="trigger">
        <div style="display:table-cell; vertical-align:middle; color: white;" tabindex="0" class="maincontent hover-img img4"><img src="STEP4.jpg" height="200" width="200"/><p style="margin: 10px 20px;">A design is not finished until you are entirely happy. When we believe the work is complete we will send you an artwork approval form for you to sign and return.<p></div>
    </div>
</div>

2 个答案:

答案 0 :(得分:0)

如果您使用 .trigger 填充,请将 box-sizing:box-border; 属性添加到其中。

要获得更详细的帮助,请发布您的css并修复实时链接,因为它会带来您自己拥有的本地文件!

答案 1 :(得分:0)

应用此css

.trigger {
  width: 200px;
  height: 200px;
  overflow: hidden;
  box-sizing: border-box;
}