margin-top with%不起作用

时间:2013-01-04 21:21:32

标签: css

我有一些列有一些行。

代码:

<div class="col-fluid">
    <div class="height1">1</div>
    <div class="height1">1</div>
    <div class="height1">1</div>
    <div class="height1">1</div>
    <div class="height1">1</div>
    <div class="height1">1</div>
    <div class="height1">1</div>
    <div class="height1">1</div>
    <div class="height1">1</div>
    <div class="height1">1</div>
    <div class="height1">1</div>
    <div class="height1">1</div>
</div>

因此,我为每个margin-top类分配了height1

.col-fluid > [class*="height"]:not(:first-child) {
    margin-top: 0.699301%;
}

现在,margin-top存在一个问题,在某些高度尺寸(我完全不知道它们)中似乎margin-top不起作用。

请参阅此屏幕截图中的第一个左栏:

margin-top doesn't work

但另一种尺寸,它有效:

margin-top Works

有什么问题?我的margin-top尺寸有问题吗?

1 个答案:

答案 0 :(得分:0)

我认为,最好这样做:

<div class="col-fluid">
    <div class="container"><div class="height1">1</div></div>
    <div class="container"><div class="height1">1</div></div>
    <div class="container"><div class="height1">1</div></div>
    <div class="container"><div class="height1">1</div></div>
    <div class="container"><div class="height1">1</div></div>
    <div class="container"><div class="height1">1</div></div>
    <div class="container"><div class="height1">1</div></div>
    <div class="container"><div class="height1">1</div></div>
    <div class="container"><div class="height1">1</div></div>
    <div class="container"><div class="height1">1</div></div>
    <div class="container"><div class="height1">1</div></div>
    <div class="container"><div class="height1">1</div></div>
</div>

.col-fluid div.container
{
  padding-top:10px;
}