【问题标题】:Is 12 columns the full page in a Zurb Foundation grid?12 列是 Zurb Foundation 网格中的整页吗?
【发布时间】:2013-11-20 20:57:18
【问题描述】:

我刚开始使用 Foundation 4 的网格系统,我的印象是 12 列布局是整个页面,但是当我打开 Foundation 并看到他们的示例时,我感到困惑。这是图片

网格下的部分说它是一个 12 列的部分,所以我感到困惑的是“入门”侧边栏。

  1. 12 列部分的宽度是多少?
  2. 什么是“入门”侧边栏? (多少列?)

【问题讨论】:

    标签: grid sass zurb-foundation compass-sass


    【解决方案1】:

    基础 4 中 12 列部分的默认宽度为 1000 像素,但您可以在 _variable.scss 文件中更改它。找到这一行:

    // $row-width: emCalc(1000);
    

    更改 '1000'(例如:1200)然后移除 cmets 并编译 Sass 文件:

    $row-width: emCalc(1200);
    

    如果您想查看使用Firebug 创建的包含多少列的任何部分。 例如,在this picture 中使用 3 列(large-3)作为侧边栏。

    我用基础写了一个网格设计的例子:

    <div class="row">
    
        <div class="large-9 columns">
            <div class="row">
                <div class="large-12 columns">
                    Left section with 9 columns and two row.
                    First row with one section(12 columns)
                    Second row with 2 section(each 6 columns)
                </div>
            </div>
            <div class="row">
                <div class="large-6 columns">
                    6 columns
                </div>
                <div class="large-6 columns">
                    6 columns
                </div>
            </div>
        </div>
    
        <div class="large-3 columns">
            Right section with 3 columns
        </div>
    
    </div>
    

    您还可以使用 sass mixin 创建新的“行”类和新的列类(例如:“大 4 列”)。

    在你的 HTML 文件中写下这段代码:

    <div class="your_custom_row">
        <div class="your_custom_columns_4">
            Define 'your_custom_row' in your sass file: @include grid-row;
            'your_custom_row' equal to 'row columns'
    
            Define 'your_custom_columns_4' in your sass file: @include grid-column(4);
            'your_custom_columns_4' equal to 'large-4 columns'
        </div>
        <div class="your_custom_columns_8">
            Define 'your_custom_columns_8' in your sass file: @include grid-column(8);
            'your_custom_columns_8' equal to 'large-8 columns'
        </div>
    </div>
    
    <div class="row">
        <div class="large-4 columns">
            'large-4 columns' equal to 'your_custom_columns_4'
        </div>
        <div class="large-8 columns">
            'large-8 columns' equal to 'your_custom_columns_8'
        </div>
    </div>
    

    在你的 sass 文件中写下这段代码:

    .your_custom_row {
        @include grid-row;
        .your_custom_columns_4 {
            @include grid-column(4);
        }
        .your_custom_columns_8 {
            @include grid-column(8);
        }
    }
    

    【讨论】:

    • 谢谢@parhum,我可以在我的页面左侧有一个十二列的部分,在同一行的页面右侧有一个三列的部分(类似于我上面的图片)?跨度>
    • 不,您可以在左侧有 9 列,在右侧有 3 列。但是您可以再次将左侧部分(大 9)分为十二列。
    • "但是您可以再次将左侧部分 (large-9) 分为十二列。"那部分对我来说没有意义。是否有更详细地解释该概念的教程或其他支持论坛?
    • 我编辑我的答案并为你写一个例子,有用吗?在您的 HTML 文件中使用此代码来了解网格设计。
    • 我编辑我的答案并为您添加一个示例。需要解释一下吗?
    猜你喜欢
    • 1970-01-01
    • 2017-04-17
    • 1970-01-01
    • 1970-01-01
    • 2014-06-29
    • 2013-02-16
    • 2023-03-29
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多