我设计的网站(www.aim.ca)正在使用nathan smith的960网格。我想将网站转换为响应,所以我调查了996网格(响应)系统。 http://996grid.com/
在实现css脚本和javascript的过程中,我遇到了一些挫折......这实际上是我第一次使用响应式网格系统。
我的问题是: - 我是否还应该修改单独样式表的div类和id以便响应?
当我调整浏览器大小时,元素不成比例,我也看到我认为是从“389”等js生成的随机数字等等
我可以使用媒体查询修改960.css本身吗?这有多难?
将基于960网格的网站转换为自适应布局的最佳方法是什么?
您的想法非常感谢!提前谢谢你。
答案 0 :(得分:2)
有一些网站在那里大部分都是为你解决的:
首先,在您的html文件/模板的头部添加meta viewport tag:
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0" />
960网格响应的最佳效果是this github project
的网站上使用了这个只需将此css文件添加到原始的960 css fyle(我必须在上述网站上将_
替换为-
):
/*
* 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;
}
}
或另一个:http://www.sitepoint.com/build-a-responsive-design-using-960-grid/
或引导您完成它: http://www.premiumdw.com/2013/02/12/convert-a-960-grid-website-to-a-responsive-design/