diff options
update @media responsive layout
3 files changed, 162 insertions, 147 deletions
| -rw-r--r-- | demo/index.html | 6 | ||||
| -rw-r--r-- | dist/spectre.css | 188 | ||||
| -rw-r--r-- | src/layout.less | 115 |
diff --git a/demo/index.html b/demo/index.html index be55664..92ac08b 100644 --- a/demo/index.html +++ b/demo/index.html @@ -4,6 +4,12 @@ <meta charset="UTF-8"> <title>Spectre, a lightweight and clean CSS framework for faster and extendable development.</title> <link rel="stylesheet" href="../dist/spectre.css"> + <style> + .columns .column { + background-color: #efefef; + border: 1px solid #ddd; + } + </style> </head> <body> <section class="container grid-960"> diff --git a/dist/spectre.css b/dist/spectre.css index 2a18f31..6b3a9fe 100644 --- a/dist/spectre.css +++ b/dist/spectre.css @@ -500,22 +500,18 @@ ol ol { list-style-type: lower-alpha; } .container { + width: 100%; margin-left: auto; margin-right: auto; padding-left: 10px; padding-right: 10px; } -.container.grid-960 { - width: 960px; -} -.container.grid-full { - width: 100%; +@media screen and (min-width: 961px) { + .container.grid-960 { + width: 960px; + } } .columns { - display: -webkit-box; - display: -webkit-flex; - display: -ms-flexbox; - display: flex; margin-left: -10px; margin-right: -10px; } @@ -526,89 +522,97 @@ ol ol { flex: 1; padding: 10px; } -.column.col-12 { - -webkit-box-flex: 0; - -webkit-flex: none; - -ms-flex: none; - flex: none; - width: 100%; -} -.column.col-11 { - -webkit-box-flex: 0; - -webkit-flex: none; - -ms-flex: none; - flex: none; - width: 91.66666667%; -} -.column.col-10 { - -webkit-box-flex: 0; - -webkit-flex: none; - -ms-flex: none; - flex: none; - width: 83.33333333%; -} -.column.col-9 { - -webkit-box-flex: 0; - -webkit-flex: none; - -ms-flex: none; - flex: none; - width: 75%; -} -.column.col-8 { - -webkit-box-flex: 0; - -webkit-flex: none; - -ms-flex: none; - flex: none; - width: 66.66666667%; -} -.column.col-7 { - -webkit-box-flex: 0; - -webkit-flex: none; - -ms-flex: none; - flex: none; - width: 58.33333333%; -} -.column.col-6 { - -webkit-box-flex: 0; - -webkit-flex: none; - -ms-flex: none; - flex: none; - width: 50%; -} -.column.col-5 { - -webkit-box-flex: 0; - -webkit-flex: none; - -ms-flex: none; - flex: none; - width: 41.66666667%; -} -.column.col-4 { - -webkit-box-flex: 0; - -webkit-flex: none; - -ms-flex: none; - flex: none; - width: 33.33333333%; -} -.column.col-3 { - -webkit-box-flex: 0; - -webkit-flex: none; - -ms-flex: none; - flex: none; - width: 25%; -} -.column.col-2 { - -webkit-box-flex: 0; - -webkit-flex: none; - -ms-flex: none; - flex: none; - width: 16.66666667%; -} -.column.col-1 { - -webkit-box-flex: 0; - -webkit-flex: none; - -ms-flex: none; - flex: none; - width: 8.33333333%; +@media screen and (min-width: 769px) { + .columns { + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; + } + .column.col-12 { + -webkit-box-flex: 0; + -webkit-flex: none; + -ms-flex: none; + flex: none; + width: 100%; + } + .column.col-11 { + -webkit-box-flex: 0; + -webkit-flex: none; + -ms-flex: none; + flex: none; + width: 91.66666667%; + } + .column.col-10 { + -webkit-box-flex: 0; + -webkit-flex: none; + -ms-flex: none; + flex: none; + width: 83.33333333%; + } + .column.col-9 { + -webkit-box-flex: 0; + -webkit-flex: none; + -ms-flex: none; + flex: none; + width: 75%; + } + .column.col-8 { + -webkit-box-flex: 0; + -webkit-flex: none; + -ms-flex: none; + flex: none; + width: 66.66666667%; + } + .column.col-7 { + -webkit-box-flex: 0; + -webkit-flex: none; + -ms-flex: none; + flex: none; + width: 58.33333333%; + } + .column.col-6 { + -webkit-box-flex: 0; + -webkit-flex: none; + -ms-flex: none; + flex: none; + width: 50%; + } + .column.col-5 { + -webkit-box-flex: 0; + -webkit-flex: none; + -ms-flex: none; + flex: none; + width: 41.66666667%; + } + .column.col-4 { + -webkit-box-flex: 0; + -webkit-flex: none; + -ms-flex: none; + flex: none; + width: 33.33333333%; + } + .column.col-3 { + -webkit-box-flex: 0; + -webkit-flex: none; + -ms-flex: none; + flex: none; + width: 25%; + } + .column.col-2 { + -webkit-box-flex: 0; + -webkit-flex: none; + -ms-flex: none; + flex: none; + width: 16.66666667%; + } + .column.col-1 { + -webkit-box-flex: 0; + -webkit-flex: none; + -ms-flex: none; + flex: none; + width: 8.33333333%; + } } .clearfix::after, .container::after, diff --git a/src/layout.less b/src/layout.less index d7f6557..8fc17e0 100644 --- a/src/layout.less +++ b/src/layout.less @@ -1,21 +1,21 @@ // Layout .container { + width: 100%; margin-left: auto; margin-right: auto; padding-left: 10px; padding-right: 10px; &:extend(.clearfix all); - - &.grid-960 { - width: 960px; - } - &.grid-full { - width: 100%; +} +@media screen and (min-width: 961px) { + .container { + &.grid-960 { + width: 960px; + } } } .columns { - display: flex; margin-left: -10px; margin-right: -10px; &:extend(.clearfix all); @@ -23,55 +23,60 @@ .column { flex: 1; padding: 10px; - - &.col-12 { - flex: none; - width: 100%; - } - &.col-11 { - flex: none; - width: 91.66666667%; - } - &.col-10 { - flex: none; - width: 83.33333333%; - } - &.col-9 { - flex: none; - width: 75%; - } - &.col-8 { - flex: none; - width: 66.66666667%; - } - &.col-7 { - flex: none; - width: 58.33333333%; - } - &.col-6 { - flex: none; - width: 50%; - } - &.col-5 { - flex: none; - width: 41.66666667%; - } - &.col-4 { - flex: none; - width: 33.33333333%; - } - &.col-3 { - flex: none; - width: 25%; - } - &.col-2 { - flex: none; - width: 16.66666667%; +} +@media screen and (min-width: 769px) { + .columns { + display: flex; } - &.col-1 { - flex: none; - width: 8.33333333%; + .column { + &.col-12 { + flex: none; + width: 100%; + } + &.col-11 { + flex: none; + width: 91.66666667%; + } + &.col-10 { + flex: none; + width: 83.33333333%; + } + &.col-9 { + flex: none; + width: 75%; + } + &.col-8 { + flex: none; + width: 66.66666667%; + } + &.col-7 { + flex: none; + width: 58.33333333%; + } + &.col-6 { + flex: none; + width: 50%; + } + &.col-5 { + flex: none; + width: 41.66666667%; + } + &.col-4 { + flex: none; + width: 33.33333333%; + } + &.col-3 { + flex: none; + width: 25%; + } + &.col-2 { + flex: none; + width: 16.66666667%; + } + &.col-1 { + flex: none; + width: 8.33333333%; + } } } - |