首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >带Susy断点和固定沟槽的susy网格

带Susy断点和固定沟槽的susy网格
EN

Stack Overflow用户
提问于 2014-06-16 07:50:53
回答 1查看 1.7K关注 0票数 0

我已经开始使用苏西,它的能力给我留下了深刻的印象。目前,我正在创建一个网络,其中我有4个媒体查询:

代码语言:javascript
复制
$mobile: 767px;
$tablet: 768px;
$small: 960px;
$large: 1200px;

对于最后两个$small和$large,我希望在px和10中有两个宽度固定的列。我不想在% bacause中使用排水沟,因为我想确保所有浏览器的结果都是相同的。

因此,对于固定的colomnus,我使用susy-断点。

代码语言:javascript
复制
@include susy-breakpoint($small, 24 1/1.5 split) {
    .container {
        @include container($small);
    }
    .main{
        .navigationWrap{
            @include span(24);
        }
        .articleWrap {
            @include span(668px);
        }
        .advertisment {
            @include span(240px);
            .advBanner{
                float: right;
            }
        }
    }

} // END of 960px mq

@include  susy-breakpoint($large, 24 1/1.5 split) {

    .container {
        @include container($large);
    }

    .main{
        .navigationWrap{
            @include span(24);//span(4);
        }
        .articleWrap {
            @include span(900px);
        }
    }

} // END of 1200px mq

那么,我的主要问题是:有什么方法和最佳实践可以使排水沟得到修正而不是%(比如1/1.5)来对网格进行更多的控制?

因为没有人回答,所以我用“我自己的方式”来得到固定的排水沟和洞穴。

设置如下:

代码语言:javascript
复制
$susy: (
  columns: 24,
  column-width: 40px,
  gutter-width: 10px,
  grid-padding: 10px,
  gutter-position: split,
  global-box-sizing: content-box,
  math: static
);

和主要的scss:

代码语言:javascript
复制
//from 960px to 1200
@include breakpoint($small) {
    .container {
        @include container($small);
    }
    .header{
        .header-logoWrap{
            @include span(242px);
        }
        .header-bannerWrap {
            @include span(678px);
            img {
                float: right;
            }
        }
    }
    .main{
        .navigationWrap{
            @include span(930px);
        }
        .articleWrap {
            @include span(670px);
        }
        .advertisment {
            @include span(250px);
            .advBanner{
                float: right;
            }
        }
    }

} // END 960px to 1200

// from 1200 final
@include breakpoint($large) {
    .container {
        @include container($large);
    }
    .header{
        .header-logoWrap{
            @include span(242px);
        }
        .header-bannerWrap {
            @include span(918px);
            img {
                float: right;
            }
        }
    }   
    .main{
        .navigationWrap{
            @include span(1170px);
        }
        .articleWrap {
            @include span(910px);
        }
        .advertisment {
            @include span(250px);
            .advBanner{
                float: right;
            }
        }
    }
} // END of 1200px mq

但主要问题仍未解决:-what是固定网格和排水沟的最佳实践吗?

在我建议的代码中,我正在使用

span( px)

如果不使用%中列的span,如何设置$susy

列: 24,列宽:40 24,

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-06-22 21:19:54

您的设置映射使用的是susy1和susy2术语的混合。大部分这些设置都被Susy忽略了。我想这就是你想要的:

代码语言:javascript
复制
$susy: (
  columns: 24,
  column-width: 40px,
  gutters: 10px/40px, 
  gutter-position: split,
  global-box-sizing: content-box,
  math: static
);

gutters设置总是相对的,但是输出不会是--因为您使用的是static数学。在流体网格中也可以有静态排水沟,但这是另一个问题。在边缘没有名为gutter-widthgrid-padding', so those have been removed. Split gutters will leave you with half-gutter padding on the grid (5px). If you want a full10 5px的设置,您可以这样做:

代码语言:javascript
复制
.container {
  padding: 0 gutters();
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/24238884

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档