Susy 2 教程 — Shorhand 篇

栏目: Html · 发布时间: 7年前

内容简介:Susy 2 教程 — Shorhand 篇
Susy 2 教程 — Shorhand 篇

Shorthand

Susy提供了一个简单的语法来轻松地将任意设置传递到函数(function)和混合宏(mixin)中。想要完全掌握Susy2, Shorthand 很关键。

简写语法(shorthand syntax)

Shorthand:    $span $grid $keywords;

$span

span 可以是任何长度的跨列。

$grid

grid 是 列(column) 的设置的,而且还可以设置 guttercolumn-width ,例如:

// 12列
$grid: 12;

// 12列,gutter为1/3
$grid: 12 1/3;

// 12列,列宽60px,gutter10px
$grid: 12 (60px 10px);

// 按 1:2:3:2:1比例分12列,gutter为1/4
$grid: (1 2 3 2 1) .25;

$keywords

keyword比较容易,几乎所有设置都带有 keyword ,因为是map类型,可以无序的写入,先看一下全局的:

$global-keywords: (
  container            : auto,
  math                 : static fluid,
  output               : isolate float,
  container-position   : left center right,
  flow                 : ltr rtl,
  gutter-position      : before after split inside inside-static,
  debug: (
    image              : show hide show-columns show-baseline,
    output             : background overlay,
  ),
);

$local-keywords: (
  box-sizing           : border-box content-box,
  edge                 : first alpha last omega,
  spread               : narrow wide wider,
  gutter-override      : no-gutters no-gutter,
  clear                : break nobreak,
  role                 : nest,
);

Examples

创建一个Layout的简写配置:

  • 语法: <grid> <keywords>
// grid: (columns: 4, gutters: 1/4, column-width: 4em);
// keywords: (math: fluid, gutter-position: inside-static, flow: rtl);
$demo: 4 (4em 1em) fluid inside-static rtl;

$result : layout($demo);

// 打印输出 
@debug $result;
// (math: fluid, gutter-position: inside-static, flow: rtl, columns: 4, gutters: 0.25, column-width: 4em)

创建一个Span的简写配置

Susy2 有大量计算或设置宽度的函数和混合宏,所以创建span的简写配置会比较常用。

  • 语法: <span> at <location> of <layout>
// span: 3;
// location: 4;
// layout: (columns: 12, gutters: .25, math: fluid)
$span: 3 at 4 of 12 .25 fluid;

// Only $span is required in most cases
$span: 30%;

预告:下一篇:通过 Susy2 打造 bootstrap 栅格系统


以上所述就是小编给大家介绍的《Susy 2 教程 — Shorhand 篇》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

算法学

算法学

哈雷尔 / 霍红卫 / 高等教育 / 2007-6 / 39.00元

本书主要论述计算机科学的基本概念、思想、方法和结果。全书内容由 5个部分组成。“预备知识”部分包括算法学中的基本概念、算法结构、算法所操纵的数据以及描述算法所用的程序设计语言。“方法和分析”部分包括算法设计的方法、算法的正确性和效率、评价算法的方法。“局限性和健壮性”部分包括可执行算法的固有局限性以及实现这些算法的计算机的固有局限性、不可计算性和不可判定性、算法学的通用性及其健壮性。此外,还讨论了......一起来看看 《算法学》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具

HEX CMYK 转换工具
HEX CMYK 转换工具

HEX CMYK 互转工具