crispy-grid 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +8 -1
- data/stylesheets/crispy/_grid.sass +14 -1
- metadata +4 -4
data/README.md
CHANGED
@@ -113,6 +113,10 @@ edge cases where you don't want to apply `border-box` to all your
|
|
113
113
|
elements. That's why setting the box-model is not part of Crispy Grid's
|
114
114
|
`$grid-box-sizing` option.
|
115
115
|
|
116
|
+
### On Fluid Grids
|
117
|
+
Crispy is fully capable of creating percentage based grids. However, when creating a fluid grid `border-box` should be used.
|
118
|
+
Nesting columns is tricky with fluid grids. Crispy provides the `fluid-sub-column` mixin to help with nested columns. (See below)
|
119
|
+
|
116
120
|
## Usage
|
117
121
|
|
118
122
|
### Mixins
|
@@ -132,10 +136,13 @@ Use might also find these mixins useful:
|
|
132
136
|
* This combines `+column` and `+last`. You should favor it over the two in order to reduce CSS output.
|
133
137
|
2. `+row`
|
134
138
|
* Use this for columns that span the whole row. This mixin just calls `+column` with the configured count of `$grid-columns`.
|
139
|
+
3. `+fluid-sub-column`
|
140
|
+
* This resets the percentage values for nested fluid columns.
|
141
|
+
Just provide the intended colspan and the parent colspan (`+fluid-sub-column(2, 4)`) and Crispy will calculate a width and gutter as if the column was not nested.
|
135
142
|
|
136
143
|
### Options
|
137
144
|
|
138
|
-
#### Options for `+column`, `+last-column`, `+row`
|
145
|
+
#### Options for `+column`, `+last-column`, `+row`, `+fluid-sub-column`
|
139
146
|
* `$colspan`
|
140
147
|
* Specifies the number of grid columns the element should span
|
141
148
|
* If the element does not fit into the grid, you can also specify a fixed width.
|
@@ -63,6 +63,13 @@ $grid-box-sizing: content-box !default
|
|
63
63
|
=row($device: default-device(), $colspan: grid-columns($device), $padding: 0, $differing-right-padding: false, $border-width: 0, $differing-right-border-width: false, $gutter: 0, $left-gutter: false, $subtract-border-from: false)
|
64
64
|
+last-column($colspan, $device, $padding, $differing-right-padding, $border-width, $differing-right-border-width, $gutter, $left-gutter, $subtract-border-from)
|
65
65
|
|
66
|
+
// Intended for use with percentage values only
|
67
|
+
// Recalculates $colspan and $gutter so that it appears as if the percentages of your nested column were relative to its grand-parent.
|
68
|
+
// The parameters are the same of =column, except for a second mandatory parameter $parent-colspan.
|
69
|
+
=fluid-sub-column($colspan, $parent-colspan, $device: default-device(), $padding: 0, $differing-right-padding: false, $border-width: 0, $differing-right-border-width: false, $gutter: grid-gutter-width($device), $left-gutter: false, $subtract-border-from: false)
|
70
|
+
+column-behavior
|
71
|
+
+column-metrics($colspan, $device, $padding, $differing-right-padding, $border-width, $differing-right-border-width, $gutter, $left-gutter, $subtract-border-from: $subtract-border-from, $parent-colspan: $parent-colspan)
|
72
|
+
|
66
73
|
// Use this mixin for your (none-floating) grid container.
|
67
74
|
// By default, it spans the whole grid-width and is centered.
|
68
75
|
// Unlike with columns, paddings and borders of a container do not affect its inner width.
|
@@ -80,7 +87,7 @@ $grid-box-sizing: content-box !default
|
|
80
87
|
=column-behavior
|
81
88
|
float: left
|
82
89
|
|
83
|
-
=column-metrics($column-width, $device: default-device(), $padding: 0, $differing-right-padding: false, $border-width: 0, $differing-right-border-width: false, $gutter: grid-gutter-width($device), $left-gutter: false, $container: false, $subtract-border-from: false)
|
90
|
+
=column-metrics($column-width, $device: default-device(), $padding: 0, $differing-right-padding: false, $border-width: 0, $differing-right-border-width: false, $gutter: grid-gutter-width($device), $left-gutter: false, $container: false, $subtract-border-from: false, $parent-colspan: false)
|
84
91
|
// Convert column counts to widths with unit
|
85
92
|
$column-width: colspan-to-width($column-width, $device)
|
86
93
|
$padding: colspan-to-width($padding, $device, $include-last-gutter: true)
|
@@ -101,6 +108,12 @@ $grid-box-sizing: content-box !default
|
|
101
108
|
$right-padding: if(($subtract-border-from == 'padding' or $subtract-border-from == 'right-padding') and $padding > 0, $right-padding - $right-border-width, $right-padding)
|
102
109
|
$padding-sum: left-and-right-sum($left-padding, $right-padding)
|
103
110
|
|
111
|
+
// Recalculate Column width for fluid sub columns
|
112
|
+
@if $parent-colspan
|
113
|
+
$parent-width: colspan-to-width($parent-colspan, $device)
|
114
|
+
$column-width: ($column-width / $parent-width) * 100%
|
115
|
+
$gutter: ($gutter / $parent-width) * 100%
|
116
|
+
|
104
117
|
// Setting width
|
105
118
|
@if $container
|
106
119
|
// Paddings and borders do not affect the inner width of a container.
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: crispy-grid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 11
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
8
|
+
- 5
|
9
9
|
- 0
|
10
|
-
version: 0.
|
10
|
+
version: 0.5.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Christian Peters
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2013-
|
19
|
+
date: 2013-11-04 00:00:00 +01:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|