【问题标题】:Zurb Foundation 5 - Row padding/marginZurb Foundation 5 - 行填充/边距
【发布时间】:2014-06-27 06:39:00
【问题描述】:

我正在尝试为我的行创建背景颜色,但是当我设置背景颜色时,它会延伸到我的列的常规宽度。 然后我尝试使用填充使行更小,这可行,但会使列更小。 我需要以某种方式移除粉红色区域,只保留红色背景,并保持列均匀。

有什么想法吗?

<!-- When applying the padding, the columns background turns OK. However, the
columns themselves aren't as even as "normal" columns without padding -->

<div class="row" style="background-color: pink; padding-right: 15px; padding-left: 15px; ">
        <div class="large-3 columns" style="background-color: red;">
        text1
        </div>
        <div class="large-3 columns" style="background-color: red;">
        text2
        </div>
         <div class="large-3 columns" style="background-color: red;">
        text3
        </div>
        <div class="large-3 columns" style="background-color: red;">
        text4
        </div>
</div>

<!-- The background of the columns is same for all of the columns, and it's 
bigger than the image because of the padding -->
<div class="row">
    <div class="large-3 columns" style="background-color: teal;">
        text1
    </div>
        <div class="large-3 columns" style="background-color: teal;">
        text2
    </div>
         <div class="large-3 columns" style="background-color: teal;">
        text3
    </div>
        <div class="large-3 columns" style="background-color: teal;">
        text4
    </div>
</div>
<!-- This image has a padding in the column, so it's not the whole width of 
the row -->
<div class="row">
    <div class="large-12 columns" style="background-color: grey;">
        <img alt="slide image" src="http://placehold.it/1000x15">
    </div>
</div>

【问题讨论】:

    标签: html css zurb-foundation


    【解决方案1】:

    一种方法是删除列填充,因为这会导致您在行 div 中看到粉红色背景,并为行添加边距以使它们对齐。

    .columns{
         padding-left: 0rem;
        padding-right: 0rem;
    }
    .row{
         margin-left: 0.83333rem;
        margin-right: 0.83333rem;
        width:auto;
    }
    

    这是Fiddle

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-03-23
      • 1970-01-01
      • 1970-01-01
      • 2013-12-19
      • 1970-01-01
      • 1970-01-01
      • 2011-04-17
      • 2020-11-27
      相关资源
      最近更新 更多