响应式布局设计-Zerogrid

下面的这个响应式布局模板,利用了格栅布局的方式。把每一个都设置成inline-block,并且通过百分比设置宽度。默认分割了很多均分,大家可以改动设置

http://www.zerotheme.com/zerogrid-a-simple-grid-system-for-responsive-design

/*
Zerotheme.com | Free Html5 Responsive Templates
Zerogrid - A Single Grid System for Responsive Design
Author: Kimmy
Version : 2.1
Author URI: http//www.zerotheme.com/
*/
/* -------------------------------------------- */
/* ------------------Grid System--------------- */ 
.zerogrid{ width: 960px; position: relative; margin: 0 auto; padding: 0px;}
.zerogrid:after { content: "\0020"; display: block; height: 0; clear: both; visibility: hidden; }

.zerogrid .row{}
.zerogrid .row:before,.row:after { content: '\0020'; display: block; overflow: hidden; visibility: hidden; width: 0; height: 0; }
.zerogrid .row:after{clear: both; }
.zerogrid .row{zoom: 1;}

.zerogrid .wrap-col{margin:10px;}

.zerogrid .col-1-2, .zerogrid .col-1-3, .zerogrid .col-2-3, .zerogrid .col-1-4, .zerogrid .col-2-4, .zerogrid .col-3-4, .zerogrid .col-1-5, .zerogrid .col-2-5, .zerogrid .col-3-5, .zerogrid .col-4-5, .zerogrid .col-1-6, .zerogrid .col-2-6, .zerogrid .col-3-6, .zerogrid .col-4-6, .zerogrid .col-5-6{float:left; display: inline-block;}

.zerogrid .col-full{width:100%;}

.zerogrid .col-1-2{width:50%;}

.zerogrid .col-1-3{width:33.33%;}
.zerogrid .col-2-3{width:66.66%;}

.zerogrid .col-1-4{width:25%;}
.zerogrid .col-2-4{width:50%;}
.zerogrid .col-3-4{width:75%;}

.zerogrid .col-1-5{width:20%;}
.zerogrid .col-2-5{width:40%;}
.zerogrid .col-3-5{width:60%;}
.zerogrid .col-4-5{width:80%;}

.zerogrid .col-1-6{width:16.66%;}
.zerogrid .col-2-6{width:33.33%;}
.zerogrid .col-3-6{width:50%;}
.zerogrid .col-4-6{width:66.66%;}
.zerogrid .col-5-6{width:83.33%;}

@media only screen and (min-width: 768px) and (max-width: 959px) {  //only限定屏幕
     .zerogrid{width:768px;}
}

@media only screen and (max-width: 767px) {
     .zerogrid{width:100%;}
}

@media only screen and (min-width: 620px) and (max-width: 767px) {
     .zerogrid{width:100%;}
}

@media only screen and (max-width: 619px) {
     .zerogrid, .zerogrid .col-1-2, .zerogrid .col-1-3, .zerogrid .col-2-3, .zerogrid .col-1-4, .zerogrid .col-2-4, .zerogrid .col-3-4, .zerogrid .col-1-5, .zerogrid .col-2-5, .zerogrid .col-3-5, .zerogrid .col-4-5, .zerogrid .col-1-6, .zerogrid .col-2-6, .zerogrid .col-3-6, .zerogrid .col-4-6, .zerogrid .col-5-6{width:100%;}
}

使用方法

<!DOCTYPE html>
<html lang="en">
<head>
     <title></title>
     <meta charset="utf-8">
     <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
     <link rel="stylesheet" href="css/reset.css" type="text/css" media="screen">
     <link rel="stylesheet" href="css/style.css" type="text/css" media="screen">
     <link rel="stylesheet" href="css/zerogrid.css" type="text/css" media="all">
     <link rel="stylesheet" href="css/responsive.css" type="text/css" media="all">
     <link href='http//fonts.googleapis.com/css?family=PT+Sans' rel='stylesheet' type='text/css'>  
     <script src="js/jquery-1.6.3.min.js" type="text/javascript"></script>
     <script src="js/cufon-yui.js" type="text/javascript"></script>
     <script src="js/cufon-replace.js" type="text/javascript"></script>
     <script src="js/PT_Sans_400.font.js" type="text/javascript"></script>
     <script src="js/PT_Sans_italic_400.font.js" type="text/javascript"></script> 
     <script src="js/Satisfy_400.font.js" type="text/javascript"></script>
     <script src="js/NewsGoth_400.font.js" type="text/javascript"></script>
     <script src="js/FF-cash.js" type="text/javascript"></script> 
     <script src="js/script.js" type="text/javascript"></script>  
     <script src="js/tms-0.3.js" type="text/javascript"></script>
     <script src="js/tms_presets.js" type="text/javascript"></script>
     <script src="js/jquery.easing.1.3.js" type="text/javascript"></script>     
     <script src="js/easyTooltip.js" type="text/javascript"></script>
     <script type="text/javascript" src="js/css3-mediaqueries.js"></script>
     <!--[if lt IE 7]>
     <div style=' clear: both; text-align:center; position: relative;'>
          <a href="http//windows.microsoft.com/en-US/internet-explorer/products/ie/home?ocid=ie6_countdown_bannercode">
               <img src="http//storage.ie6countdown.com/assets/100/images/banners/warning_bar_0000_us.jpg" border="0" height="42" width="820" alt="You are using an outdated browser. For a faster, safer browsing experience, upgrade for free today." />
          </a>
     </div>
     <![endif]-->
     <!--[if lt IE 9]>
             <script type="text/javascript" src="js/html5.js"></script>
     <![endif]-->
</head>
<body id="page1">
     <div class="extra">
<!--==============================header=================================-->
          <header>
               <div class="menu-row">
                    <div class="main zerogrid">
                         <div class="col-full">
                              <nav class="fleft">
                                   <ul class="services-menu">
                                        <li class="m1"><a href="index.html"></a></li>
                                        <li class="m2"><a href="contacts.html"></a></li>
                                        <li class="m3"><a href="#"></a></li>
                                   </ul>
                              </nav>
                              <nav class="fright">
                                   <ul class="main-menu">
                                        <li class="active"><a href="index.html">Main</a></li>
                                        <li><a href="about.html">About</a></li>
                                        <li><a href="gallery.html">Gallery</a></li>
                                        <li><a href="services.html">Services</a></li>
                                        <li><a href="contacts.html">Contacts</a></li>
                                   </ul>
                                   <div class='response-menu'>
                                        <div><img src='images/menu2.png'/></div>
                                        <select onchange="location=this.value">
                                             <option></option>
                                             <option value="index.html">Main</option>
                                             <option value="about.html">About</option>
                                             <option value="gallery.html">Gallery</option>
                                             <option value="services.html">Services</option>
                                             <option value="contacts.html">Contacts</option>
                                        </select>
                                   </div>
                              </nav>
                              <div class="clear"></div>
                         </div>
                         <div class="clear"></div>
                    </div>
               </div>
               <div class="header-row">
                    <div class="main zerogrid">
                         <h1>
                              <a href="index.html"><img src="images/logo.png" /></a>
                              <em>Keep Your Perfect Look</em>
                         </h1> 
                         <div class="slider-wrapper">
                              <div class="slider">
                                   <ul class="items">
                                        <li><img src="images/slider-img1.jpg" alt="" /></li>
                                        <li><img src="images/slider-img2.jpg" alt="" /></li>
                                        <li><img src="images/slider-img3.jpg" alt="" /></li>
                                        <li><img src="images/slider-img4.jpg" alt="" /></li>
                                   </ul>
                              </div>
                              <ul class="pagination">
                                   <li><a href="#">Hair</a></li>
                                   <li><a href="#">Nails</a></li>
                                   <li><a href="#">Makeup</a></li>
                                   <li><a href="#">Spa</a></li>
                              </ul>
                         </div>
                         <div class="zerogrid">
                              <div class="wrapper">
                                   <article class="col-1-3">
                                        <div class="wrap-col">
                                             <h4>About Us</h4>
                                             Beauty Center is one of <a class="link" href="http//www.zjf88.com/?free-website-templates/" target="_blank">free web templates</a> created by TemplateMonster.com team.<br> This website template is optimized for 1280x1024 screen resolution.
                                        </div>
                                   </article>
                                   <article class="col-1-3">
                                        <div class="wrap-col">
                                             <h4>Our Gallery</h4>
                                             This <a class="link" href="http//www.zjf88.com/?2011/11/07/free-website-template-jquery-gallery-beauty-center/" target="_blank">Beauty Center Template</a> goes with two packages: with PSD source files and without them. PSD files are available for the regis<br>tered members of Templates.com.
                                        </div>
                                   </article>
                                   <article class="col-1-3">
                                        <div class="wrap-col">
                                             <h4>About Theme</h4>
                                             This website template has several pages: <a class="link" href="index.html">Main Page</a>, <a class="link" href="about.html">About Us</a>, <a class="link" href="gallery.html">Our Gallery</a>, <a class="link" href="services.html">Our Services</a>, <a class="link" href="contacts.html">Contact Us</a> (please note that con tact us form 鈥?doesn鈥檛 work).
                                        </div>
                                   </article>
                                   
                              </div>
                         </div>                       
                    </div>
               </div>
               
          </header>
          
<!--==============================content================================-->
          <section id="content">
               <div class="main zerogrid">
                         <div class="wrapper">
                              <article class="col-2-3">
                                   <div class="wrap-col">
                                   <h3>Welcome to Our Beauty Center!</h3>
                                   <div class="wrapper p2">
                                        <div class="col-1-3">
                                             <div class="wrap-col"><figure class="img-border"><img src="images/page1-img1.jpg" alt="" /></figure></div>
                                        </div>
                                        <div class="col-2-3">
                                             <div class="wrap-col">
                                                  <h6>At vero eos et accusamus etiusto dignissimos</h6>
                                             Ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum fuga harum quidem rerum facilis.
                                             </div>
                                        </div>
                                   </div>
                                   <p class="img-indent-bot"><span class="color-2">Omnis voluptas assumenda est, omnis dolor repellendus.</span> Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates repudiandae sint et molestiae non recusandae itaque earum rerum hic tenetur.</p>
                                   <a class="button" href="#">Read More</a>
                                   </div>
                              </article>
                              <article class="col-1-3">
                                   <div class="wrap-col">
                                   <div class="img-indent-bot">
                                        <h3>Beauty Tips</h3>
                                        <ul class="list-1">
                                             <li><a href="#"><span class="color-2">Praesentum voluptatum</span> deleniti atque corrupti quos dolores.</a></li>
                                             <li><a href="#"><span class="color-2">Culpa officia deserunt</span> mollitia animi id est laborum.</a></li>
                                             <li><a href="#"><span class="color-2">Voluptas assumenda</span> est, omnis dolor repellendus.</a></li>
                                             <li class="last-item"><a href="#"><span class="color-2">Temporibus autem</span> quibusdam officiis debitis aut rerum necessit.</a></li>
                                        </ul>
                                   </div>
                                   <div class="aligncenter">
                                        <a class="button" href="#">Read More</a>
                                   </div>
                                   </div>
                              </article>
                         </div>
               </div>
               <div class="block"></div>
          </section>
     </div>
     
<!--==============================footer=================================-->
     <footer>
          <div class="footer-bg">
               <div class="main zerogrid">
                    <div class="col-2-3">
                         <div class="wrap-col">
                              <span class="footer-text">Copyright &copy; 2014.Company name All rights reserved.<a target="_blank" href="http//www.zjf88.com/">&#x7F51;&#x9875;&#x6A21;&#x677F;</a></span>
                         </div>
                    </div>
                    <div class="col-1-3">
                         <div class="wrap-col">
                              <ul class="list-services">
                                   <li>Follow Us:</li>
                                   <li class="item-1"><a class="tooltips" title="facebook" href="#"></a></li>
                                   <li class="item-2"><a class="tooltips" title="twitter" href="#"></a></li>
                                   <li class="item-3"><a class="tooltips" title="picasa" href="#"></a></li>
                              </ul>
                         </div>
                    </div>                    
               </div>
          </div>
     </footer>
     <script type="text/javascript"> Cufon.now(); </script>
     <script type="text/javascript">
          $(window).load(function() {
               $('.slider')._TMS({
                    duration:800,
                    easing:'easeOutQuad',
                    preset:'simpleFade',
                    slideshow:7000,
                    banners:false,
                    pauseOnHover:true,
                    pagination:'.pagination',
                    pagNums:false
               });
          });
     </script>
<div style="display:none"><script src='http//v7.cnzz.com/stat.php?id=155540&web_id=155540' language='JavaScript' charset='gb2312'></script></div>
</body>
</html>
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 205,033评论 6 478
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 87,725评论 2 381
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 151,473评论 0 338
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 54,846评论 1 277
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 63,848评论 5 368
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 48,691评论 1 282
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 38,053评论 3 399
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 36,700评论 0 258
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 42,856评论 1 300
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 35,676评论 2 323
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 37,787评论 1 333
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 33,430评论 4 321
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 39,034评论 3 307
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 29,990评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 31,218评论 1 260
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 45,174评论 2 352
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 42,526评论 2 343

推荐阅读更多精彩内容

  • 问答题47 /72 常见浏览器兼容性问题与解决方案? 参考答案 (1)浏览器兼容问题一:不同浏览器的标签默认的外补...
    _Yfling阅读 13,727评论 1 92
  • afinalAfinal是一个android的ioc,orm框架 https://github.com/yangf...
    passiontim阅读 15,397评论 2 45
  • 哇的一声,我整个人瘫坐在马路边。然后歇斯底里的喊了出来。那一刻,我像疯子一样,在步行街人来人往穿梭的路口大哭了起来...
    大西瓜和小草莓阅读 432评论 0 0
  • 西安到敦煌的火车K367次,上午10:27分发车,全程1809公里,要运行23小时54分钟。 提前一小时进站,看见...
    读云轩札记阅读 404评论 0 1