milligram/src/_Grid.sass

165 lines
3.2 KiB
Sass
Raw Permalink Normal View History

2015-12-26 01:57:14 +00:00
// Grid
//
2016-01-30 05:25:57 +00:00
// .container is main centered wrapper with a max width of 112.0rem (1120px)
2015-12-26 01:57:14 +00:00
.container
2020-05-17 21:41:05 +00:00
margin: 0 auto
max-width: 112.0rem
padding: 0 2.0rem
position: relative
width: 100%
2015-12-26 01:57:14 +00:00
// Using flexbox for the grid, inspired by Philip Walton:
// http://philipwalton.github.io/solved-by-flexbox/demos/grids/
// By default each .column within a .row will evenly take up
// available width, and the height of each .column with take
2016-07-03 21:54:08 +00:00
// up the height of the tallest .column in the same .row
2015-12-26 01:57:14 +00:00
.row
2020-05-17 21:41:05 +00:00
display: flex
flex-direction: column
padding: 0
width: 100%
2015-12-26 01:57:14 +00:00
2020-05-17 21:41:05 +00:00
&.row-no-padding
padding: 0
2015-12-26 01:57:14 +00:00
2020-05-17 21:41:05 +00:00
&> .column
padding: 0
2016-08-01 06:04:03 +00:00
2020-05-17 21:41:05 +00:00
&.row-wrap
flex-wrap: wrap
2015-12-26 01:57:14 +00:00
2020-05-17 21:41:05 +00:00
// Vertically Align Columns
// .row-* vertically aligns every .col in the .row
&.row-top
align-items: flex-start
2015-12-26 01:57:14 +00:00
2020-05-17 21:41:05 +00:00
&.row-bottom
align-items: flex-end
2015-12-26 01:57:14 +00:00
2020-05-17 21:41:05 +00:00
&.row-center
align-items: center
2015-12-26 01:57:14 +00:00
2020-05-17 21:41:05 +00:00
&.row-stretch
align-items: stretch
2015-12-26 01:57:14 +00:00
2020-05-17 21:41:05 +00:00
&.row-baseline
align-items: baseline
2015-12-26 01:57:14 +00:00
2020-05-17 21:41:05 +00:00
.column
display: block
// IE 11 required specifying the flex-basis otherwise it breaks mobile
flex: 1 1 auto
margin-left: 0
max-width: 100%
width: 100%
2015-12-26 01:57:14 +00:00
2020-05-17 21:41:05 +00:00
// Column Offsets
&.column-offset-10
margin-left: 10%
2015-12-26 01:57:14 +00:00
2020-05-17 21:41:05 +00:00
&.column-offset-20
margin-left: 20%
2015-12-26 01:57:14 +00:00
2020-05-17 21:41:05 +00:00
&.column-offset-25
margin-left: 25%
2015-12-26 01:57:14 +00:00
2020-05-17 21:41:05 +00:00
&.column-offset-33,
&.column-offset-34
margin-left: 33.3333%
2015-12-26 01:57:14 +00:00
&.column-offset-40
margin-left: 40%
2019-04-28 07:21:10 +00:00
2020-05-17 21:41:05 +00:00
&.column-offset-50
margin-left: 50%
2015-12-26 01:57:14 +00:00
&.column-offset-60
margin-left: 60%
2020-05-17 21:41:05 +00:00
&.column-offset-66,
&.column-offset-67
margin-left: 66.6666%
2015-12-26 01:57:14 +00:00
2020-05-17 21:41:05 +00:00
&.column-offset-75
margin-left: 75%
2015-12-26 01:57:14 +00:00
2020-05-17 21:41:05 +00:00
&.column-offset-80
margin-left: 80%
2015-12-26 01:57:14 +00:00
2020-05-17 21:41:05 +00:00
&.column-offset-90
margin-left: 90%
2015-12-26 01:57:14 +00:00
2020-05-17 21:41:05 +00:00
// Explicit Column Percent Sizes
// By default each grid column will evenly distribute
// across the grid. However, you can specify individual
// columns to take up a certain size of the available area
&.column-10
flex: 0 0 10%
max-width: 10%
2015-12-26 01:57:14 +00:00
2020-05-17 21:41:05 +00:00
&.column-20
flex: 0 0 20%
max-width: 20%
2015-12-26 01:57:14 +00:00
2020-05-17 21:41:05 +00:00
&.column-25
flex: 0 0 25%
max-width: 25%
2015-12-26 01:57:14 +00:00
2020-05-17 21:41:05 +00:00
&.column-33,
&.column-34
flex: 0 0 33.3333%
max-width: 33.3333%
2015-12-26 01:57:14 +00:00
2020-05-17 21:41:05 +00:00
&.column-40
flex: 0 0 40%
max-width: 40%
2015-12-26 01:57:14 +00:00
2020-05-17 21:41:05 +00:00
&.column-50
flex: 0 0 50%
max-width: 50%
2015-12-26 01:57:14 +00:00
2020-05-17 21:41:05 +00:00
&.column-60
flex: 0 0 60%
max-width: 60%
2015-12-26 01:57:14 +00:00
2020-05-17 21:41:05 +00:00
&.column-66,
&.column-67
flex: 0 0 66.6666%
max-width: 66.6666%
2015-12-26 01:57:14 +00:00
2020-05-17 21:41:05 +00:00
&.column-75
flex: 0 0 75%
max-width: 75%
2015-12-26 01:57:14 +00:00
2020-05-17 21:41:05 +00:00
&.column-80
flex: 0 0 80%
max-width: 80%
2015-12-26 01:57:14 +00:00
2020-05-17 21:41:05 +00:00
&.column-90
flex: 0 0 90%
max-width: 90%
2015-12-26 01:57:14 +00:00
2020-05-17 21:41:05 +00:00
// .column-* vertically aligns an individual .column
.column-top
align-self: flex-start
2016-09-10 00:53:14 +00:00
2020-05-17 21:41:05 +00:00
.column-bottom
align-self: flex-end
2016-09-10 00:53:14 +00:00
2020-05-17 21:41:05 +00:00
.column-center
align-self: center
2016-09-10 00:53:14 +00:00
2015-12-26 01:57:14 +00:00
// Larger than mobile screen
2016-09-10 05:26:01 +00:00
@media (min-width: 40.0rem) // Safari desktop has a bug using `rem`, but Safari mobile works
2015-12-26 01:57:14 +00:00
2020-05-17 21:41:05 +00:00
.row
flex-direction: row
margin-left: -1.0rem
width: calc(100% + 2.0rem)
2015-12-26 01:57:14 +00:00
2020-05-17 21:41:05 +00:00
.column
margin-bottom: inherit
padding: 0 1.0rem