1

我设计的网站 (www.aim.ca) 使用的是 nathan smith 的 960 网格。我想将网站转换为响应式,因此我研究了 996 网格(响应式)系统。http://996grid.com/

在实现css脚本和javascript的过程中,我遇到了一些挫折……这实际上是我第一次使用响应式网格系统。

我的问题是: - 我是否也应该修改我的单独样式表的 div 类和 id 以使其响应?

  • 当我调整浏览器大小时,元素不成比例,我还看到我认为是从 js 生成的随机数,例如“389”等

  • 我可以使用媒体查询修改 960.css 本身吗?这有多难?

  • 将基于 960 网格的网站转换为响应式布局的最佳方法是什么?

非常感谢您的想法!先感谢您。

4

1 回答 1

3

there are a few websites out there that for the most part solve it for you:

First, add a meta viewport tag to your head of your html file/template:

<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0" />

best one for 960 grid responsiveness is this github project

Just add this css file below your original 960 css fyle (I had to replace the _ with -):

/*
* 960 Responsive Grid
* Copyright 2012, Tyler Wolff
* Free to use under the MIT license.
* http://www.opensource.org/licenses/mit-license.php
* 12/10/2012
*/

/* Tablet Portrait width to 960px */
@media only screen and (min-width: 768px) and (max-width: 959px) {

  body {
    min-width: 768px;
  }

  .container_12,
  .container_16 {
    width: 768px;
  }

  .container_12 .grid_1  { width: 44px; }
  .container_12 .grid_2  { width: 108px; }
  .container_12 .grid_3  { width: 172px; }
  .container_12 .grid_4  { width: 236px; }
  .container_12 .grid_5  { width: 300px; }
  .container_12 .grid_6  { width: 364px; }
  .container_12 .grid_7  { width: 428px; }
  .container_12 .grid_8  { width: 492px; }
  .container_12 .grid_9  { width: 556px; }
  .container_12 .grid_10 { width: 620px; }
  .container_12 .grid_11 { width: 684px; }
  .container_12 .grid_12 { width: 748px; }

  .container_16 .grid_1  { width: 28px; }
  .container_16 .grid_2  { width: 76px; }
  .container_16 .grid_3  { width: 124px; }
  .container_16 .grid_4  { width: 172px; }
  .container_16 .grid_5  { width: 220px; }
  .container_16 .grid_6  { width: 268px; }
  .container_16 .grid_7  { width: 316px; }
  .container_16 .grid_8  { width: 364px; }
  .container_16 .grid_9  { width: 412px; }
  .container_16 .grid_10 { width: 460px; }
  .container_16 .grid_11 { width: 508px; }
  .container_16 .grid_12 { width: 556px; }
  .container_16 .grid_13 { width: 604px; }
  .container_16 .grid_14 { width: 652px; }
  .container_16 .grid_15 { width: 700px; }
  .container_16 .grid_16 { width: 748px; }

  .container_12 .prefix_1  { padding-left: 64px; }
  .container_12 .prefix_2  { padding-left: 128px; }
  .container_12 .prefix_3  { padding-left: 192px; }
  .container_12 .prefix_4  { padding-left: 256px; }
  .container_12 .prefix_5  { padding-left: 320px; }
  .container_12 .prefix_6  { padding-left: 384px; }
  .container_12 .prefix_7  { padding-left: 448px; }
  .container_12 .prefix_8  { padding-left: 512px; }
  .container_12 .prefix_9  { padding-left: 576px; }
  .container_12 .prefix_10 { padding-left: 640px; }
  .container_12 .prefix_11 { padding-left: 704px; }

  .container_16 .prefix_1  { padding-left: 48px; }
  .container_16 .prefix_2  { padding-left: 96px; }
  .container_16 .prefix_3  { padding-left: 144px; }
  .container_16 .prefix_4  { padding-left: 192px; }
  .container_16 .prefix_5  { padding-left: 240px; }
  .container_16 .prefix_6  { padding-left: 288px; }
  .container_16 .prefix_7  { padding-left: 336px; }
  .container_16 .prefix_8  { padding-left: 384px; }
  .container_16 .prefix_9  { padding-left: 432px; }
  .container_16 .prefix_10 { padding-left: 480px; }
  .container_16 .prefix_11 { padding-left: 528px; }
  .container_16 .prefix_12 { padding-left: 576px; }
  .container_16 .prefix_13 { padding-left: 624px; }
  .container_16 .prefix_14 { padding-left: 672px; }
  .container_16 .prefix_15 { padding-left: 720px; }

  .container_12 .suffix_1  { padding-right: 64px; }
  .container_12 .suffix_2  { padding-right: 128px; }
  .container_12 .suffix_3  { padding-right: 192px; }
  .container_12 .suffix_4  { padding-right: 256px; }
  .container_12 .suffix_5  { padding-right: 320px; }
  .container_12 .suffix_6  { padding-right: 384px; }
  .container_12 .suffix_7  { padding-right: 448px; }
  .container_12 .suffix_8  { padding-right: 512px; }
  .container_12 .suffix_9  { padding-right: 576px; }
  .container_12 .suffix_10 { padding-right: 640px; }
  .container_12 .suffix_11 { padding-right: 704px; }

  .container_16 .suffix_1  { padding-right: 48px; }
  .container_16 .suffix_2  { padding-right: 96px; }
  .container_16 .suffix_3  { padding-right: 144px; }
  .container_16 .suffix_4  { padding-right: 192px; }
  .container_16 .suffix_5  { padding-right: 240px; }
  .container_16 .suffix_6  { padding-right: 288px; }
  .container_16 .suffix_7  { padding-right: 336px; }
  .container_16 .suffix_8  { padding-right: 384px; }
  .container_16 .suffix_9  { padding-right: 432px; }
  .container_16 .suffix_10 { padding-right: 480px; }
  .container_16 .suffix_11 { padding-right: 528px; }
  .container_16 .suffix_12 { padding-right: 576px; }
  .container_16 .suffix_13 { padding-right: 624px; }
  .container_16 .suffix_14 { padding-right: 672px; }
  .container_16 .suffix_15 { padding-right: 720px; }

  .container_12 .push_1  { left: 64px; }
  .container_12 .push_2  { left: 128px; }
  .container_12 .push_3  { left: 192px; }
  .container_12 .push_4  { left: 256px; }
  .container_12 .push_5  { left: 320px; }
  .container_12 .push_6  { left: 384px; }
  .container_12 .push_7  { left: 448px; }
  .container_12 .push_8  { left: 512px; }
  .container_12 .push_9  { left: 576px; }
  .container_12 .push_10 { left: 640px; }
  .container_12 .push_11 { left: 704px; }

  .container_16 .push_1  { left: 48px; }
  .container_16 .push_2  { left: 96px; }
  .container_16 .push_3  { left: 144px; }
  .container_16 .push_4  { left: 192px; }
  .container_16 .push_5  { left: 240px; }
  .container_16 .push_6  { left: 288px; }
  .container_16 .push_7  { left: 336px; }
  .container_16 .push_8  { left: 384px; }
  .container_16 .push_9  { left: 432px; }
  .container_16 .push_10 { left: 480px; }
  .container_16 .push_11 { left: 528px; }
  .container_16 .push_12 { left: 576px; }
  .container_16 .push_13 { left: 624px; }
  .container_16 .push_14 { left: 672px; }
  .container_16 .push_15 { left: 720px; }

  .container_12 .pull_1  { left: -64px; }
  .container_12 .pull_2  { left: -128px; }
  .container_12 .pull_3  { left: -192px; }
  .container_12 .pull_4  { left: -256px; }
  .container_12 .pull_5  { left: -320px; }
  .container_12 .pull_6  { left: -384px; }
  .container_12 .pull_7  { left: -448px; }
  .container_12 .pull_8  { left: -512px; }
  .container_12 .pull_9  { left: -576px; }
  .container_12 .pull_10 { left: -640px; }
  .container_12 .pull_11 { left: -704px; }

  .container_16 .pull_1  { left: -48px; }
  .container_16 .pull_2  { left: -96px; }
  .container_16 .pull_3  { left: -144px; }
  .container_16 .pull_4  { left: -192px; }
  .container_16 .pull_5  { left: -240px; }
  .container_16 .pull_6  { left: -288px; }
  .container_16 .pull_7  { left: -336px; }
  .container_16 .pull_8  { left: -384px; }
  .container_16 .pull_9  { left: -432px; }
  .container_16 .pull_10 { left: -480px; }
  .container_16 .pull_11 { left: -528px; }
  .container_16 .pull_12 { left: -576px; }
  .container_16 .pull_13 { left: -624px; }
  .container_16 .pull_14 { left: -672px; }
  .container_16 .pull_15 { left: -720px; }

}

/* All Mobile Widths */
@media only screen and (max-width: 767px) {

  body {
    min-width: 300px;
  }

  .container_12,
  .container_16 {
    width: 300px;
  }

  .container_12 .grid_1,
  .container_16 .grid_1,
  .container_12 .grid_2,
  .container_16 .grid_2,
  .container_12 .grid_3,
  .container_16 .grid_3,
  .container_12 .grid_4,
  .container_16 .grid_4,
  .container_12 .grid_5,
  .container_16 .grid_5,
  .container_12 .grid_6,
  .container_16 .grid_6,
  .container_12 .grid_7,
  .container_16 .grid_7,
  .container_12 .grid_8,
  .container_16 .grid_8,
  .container_12 .grid_9,
  .container_16 .grid_9,
  .container_12 .grid_10,
  .container_16 .grid_10,
  .container_12 .grid_11,
  .container_16 .grid_11,
  .container_12 .grid_12,
  .container_16 .grid_12,
  .container_12 .grid_13,
  .container_16 .grid_13,
  .container_12 .grid_14,
  .container_16 .grid_14,
  .container_12 .grid_15,
  .container_16 .grid_15,
  .container_12 .grid_16,
  .container_16 .grid_16 {
    margin: 0;
    width: 300px;
  }

  .container_12 .prefix_1,
  .container_16 .prefix_1,
  .container_12 .prefix_2,
  .container_16 .prefix_2,
  .container_12 .prefix_3,
  .container_16 .prefix_3,
  .container_12 .prefix_4,
  .container_16 .prefix_4,
  .container_12 .prefix_5,
  .container_16 .prefix_5,
  .container_12 .prefix_6,
  .container_16 .prefix_6,
  .container_12 .prefix_7,
  .container_16 .prefix_7,
  .container_12 .prefix_8,
  .container_16 .prefix_8,
  .container_12 .prefix_9,
  .container_16 .prefix_9,
  .container_12 .prefix_10,
  .container_16 .prefix_10,
  .container_12 .prefix_11,
  .container_16 .prefix_11,
  .container_12 .prefix_12,
  .container_16 .prefix_12,
  .container_12 .prefix_13,
  .container_16 .prefix_13,
  .container_12 .prefix_14,
  .container_16 .prefix_14,
  .container_12 .prefix_15,
  .container_16 .prefix_15 {
    padding-left: 0;
  }

  .container_12 .suffix_1,
  .container_16 .suffix_1,
  .container_12 .suffix_2,
  .container_16 .suffix_2,
  .container_12 .suffix_3,
  .container_16 .suffix_3,
  .container_12 .suffix_4,
  .container_16 .suffix_4,
  .container_12 .suffix_5,
  .container_16 .suffix_5,
  .container_12 .suffix_6,
  .container_16 .suffix_6,
  .container_12 .suffix_7,
  .container_16 .suffix_7,
  .container_12 .suffix_8,
  .container_16 .suffix_8,
  .container_12 .suffix_9,
  .container_16 .suffix_9,
  .container_12 .suffix_10,
  .container_16 .suffix_10,
  .container_12 .suffix_11,
  .container_16 .suffix_11,
  .container_12 .suffix_12,
  .container_16 .suffix_12,
  .container_12 .suffix_13,
  .container_16 .suffix_13,
  .container_12 .suffix_14,
  .container_16 .suffix_14,
  .container_12 .suffix_15,
  .container_16 .suffix_15 {
    padding-right: 0;
  }

  .container_12 .push_1,
  .container_16 .push_1,
  .container_12 .push_2,
  .container_16 .push_2,
  .container_12 .push_3,
  .container_16 .push_3,
  .container_12 .push_4,
  .container_16 .push_4,
  .container_12 .push_5,
  .container_16 .push_5,
  .container_12 .push_6,
  .container_16 .push_6,
  .container_12 .push_7,
  .container_16 .push_7,
  .container_12 .push_8,
  .container_16 .push_8,
  .container_12 .push_9,
  .container_16 .push_9,
  .container_12 .push_10,
  .container_16 .push_10,
  .container_12 .push_11,
  .container_16 .push_11,
  .container_12 .push_12,
  .container_16 .push_12,
  .container_12 .push_13,
  .container_16 .push_13,
  .container_12 .push_14,
  .container_16 .push_14,
  .container_12 .push_15,
  .container_16 .push_15,
  .container_12 .pull_1,
  .container_16 .pull_1,
  .container_12 .pull_2,
  .container_16 .pull_2,
  .container_12 .pull_3,
  .container_16 .pull_3,
  .container_12 .pull_4,
  .container_16 .pull_4,
  .container_12 .pull_5,
  .container_16 .pull_5,
  .container_12 .pull_6,
  .container_16 .pull_6,
  .container_12 .pull_7,
  .container_16 .pull_7,
  .container_12 .pull_8,
  .container_16 .pull_8,
  .container_12 .pull_9,
  .container_16 .pull_9,
  .container_12 .pull_10,
  .container_16 .pull_10,
  .container_12 .pull_11,
  .container_16 .pull_11,
  .container_12 .pull_12,
  .container_16 .pull_12,
  .container_12 .pull_13,
  .container_16 .pull_13,
  .container_12 .pull_14,
  .container_16 .pull_14,
  .container_12 .pull_15,
  .container_16 .pull_15 {
    left: 0;
  }

}

/* Mobile Landscape Width to Tablet Portrait Width */
@media only screen and (min-width: 480px) and (max-width: 767px) {

  body {
    min-width: 480px;
  }

  .container_12,
  .container_16 {
    width: 420px;
  }

  .container_12 .grid_1,
  .container_16 .grid_1,
  .container_12 .grid_2,
  .container_16 .grid_2,
  .container_12 .grid_3,
  .container_16 .grid_3,
  .container_12 .grid_4,
  .container_16 .grid_4,
  .container_12 .grid_5,
  .container_16 .grid_5,
  .container_12 .grid_6,
  .container_16 .grid_6,
  .container_12 .grid_7,
  .container_16 .grid_7,
  .container_12 .grid_8,
  .container_16 .grid_8,
  .container_12 .grid_9,
  .container_16 .grid_9,
  .container_12 .grid_10,
  .container_16 .grid_10,
  .container_12 .grid_11,
  .container_16 .grid_11,
  .container_12 .grid_12,
  .container_16 .grid_12,
  .container_12 .grid_13,
  .container_16 .grid_13,
  .container_12 .grid_14,
  .container_16 .grid_14,
  .container_12 .grid_15,
  .container_16 .grid_15,
  .container_12 .grid_16,
  .container_16 .grid_16 {
    margin: 0;
    width: 420px;
  }

}

Or another one: http://www.sitepoint.com/build-a-responsive-design-using-960-grid/

or guide you through it: http://www.premiumdw.com/2013/02/12/convert-a-960-grid-website-to-a-responsive-design/

于 2015-03-04T09:42:18.437 回答