如果您喜歡這些文章,歡迎點擊此處訂閱本Blog

欧美三区_成人在线免费观看视频_欧美极品少妇xxxxⅹ免费视频_a级毛片免费播放_鲁一鲁中文字幕久久_亚洲一级特黄

使用960網格系統(960 Grid System)設計網頁

系統 1905 0
<!-- Feedsky FEED發布代碼開始 --> 如果您喜歡這些文章,歡迎點擊此處訂閱本Blog <!-- FEED自動發現標記開始 --> <link title="RSS 2.0" type="application/rss+xml" rel="alternate"> <!-- FEED自動發現標記結束 --> Blog 訂閱

<!--Google 468*60橫幅廣告開始--><script type="text/javascript"><!-- google_ad_client = "pub-7343546549496470"; google_ad_width = 468; google_ad_height = 60; google_ad_format = "468x60_as"; google_ad_type = "image"; //2007-07-26: CSDN google_ad_channel = "6063905817"; google_color_border = "6699CC"; google_color_bg = "E6E6E6"; google_color_link = "FFFFFF"; google_color_text = "333333"; google_color_url = "AECCEB"; google_ui_features = "rc:6"; //--> </script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script><!--Google 468*60橫幅廣告結束-->

CSS框架已經出現很長時間了,關于這些框架的用處也被我們討論了很多遍了。有人說,CSS框架不夠先進,還有人說這些框架大大的節省了他們的開發時間。在此,我們將不再討論這個問題。

前段時間,我了解到了CSS框架。經過對Malo、BluePrint和960做了實驗對比后,我得出一個結論:我最喜歡960CSS框架。

本教程將解釋這個框架的基本原理,這樣你就可以用960來快速進入開發。(注:960網格系統官方網站 點擊進入

基本原理

你必須知道一些基本原理來“ 學習這個框架是如何工作的 ”。你可以通過實驗(或者是用firebug)來學習它,不過我也將會在這里為你介紹它。讓我們開始吧。

不要編輯960.css文件

首先是一個小提示:不要編輯960.css文件,否則,將來你將不能更新這個框架。因為盡管我們需要布局我們的HTML,我們將創建一個獨立的CSS文件。

加載網格

因為我們可以使用一個外部文件的CSS代碼,我們必須在我們的HTML網站中加載它們,我們可以通過以下代碼來實現:

  1. < link rel =”stylesheet” type =”text/css” media =”all” href =”path/to/960/reset.css” />

  2. < link rel =”stylesheet” type =”text/css” media =”all” href =”path/to/960/960.css” />

  3. < link rel =”stylesheet” type =”text/css” media =”all” href =”path/to/960/text.css” />

這些做好了之后,我們必須添加我們自己的CSS文件。例如,你可以叫這個文件為 style.css site.css 或者其它任何名字。用下面代碼引用這個文件:
  1. < link rel =”stylesheet” type =”text/css” media =”all” href =”path/to/style.css” />

容器

在960框架中,你可以選擇名為 .container_12 .container_16 的兩個容器class。他們都是960px的寬度(這就是為什么叫960),它們的不同是分的列數不同。 .container_12 被分割為12列, .container_16 被分割為16列。這些960px寬的容器是水平居中的。

網格/列

有很多列寬可供選擇,而且在這兩個容器里,這些寬度也不相同。你可以通過打開 960.css 文件來查看這些寬度。但是這對于設計一個網站來說是不必要的。有一個小技巧可以讓這個框架更加易用。

比如,你想要在你的容器里建兩列(叫sidebar/content)。你可以這樣做:

  1. < div class = "container_12" >
  2. < div class = "grid_4" > sidebar </ div >
  3. < div class = "grid_8" > maincontent </ div >
  4. </ div >

可以看到,你的第一列(grid_ 4 )的數字加上第二列(grid_ 8 )的數字正好是 12 。也就是說,你不必知道每一列的寬度,你可以選擇列寬通過一些簡單的數學計算。

如果我們要建一個4列的布局,代碼可以是這樣的:

  1. < div class = "container_12" >
  2. < div class = "grid_2" > sidebar </ div >
  3. < div class = "grid_6" > maincontent </ div >
  4. < div class = "grid_2" > photo’s </ div >
  5. < div class = "grid_2" > advertisement </ div >
  6. </ div >

正如你所看到的那樣,這個系統依然很完美。但是如果你想使用嵌套的列的話,你會發現它是有問題的。比如,如果后面三列都屬于content列:

  1. < div class = "container_12" >
  2. < div class = "grid_2" > sidebar </ div >
  3. < div class = "grid_10" >
  4. < div class = "grid_6" > maincontent </ div >
  5. < div class = "grid_2" > photo’s </ div >
  6. < div class = "grid_2" > advertisement </ div >
  7. </ div >
  8. </ div >

你會發現這錯位了,不過不用著急,這正是我們下一節要說的。

間距

默認情況下,每列之間都有間距。每一個grid_(這里代表數字)class左右都有10個像素的間距。也就是說,兩列之間,總共有20px的間距。

20px間距對創建一個有足夠寬的空白間距的布局來說是很棒的,它可以讓一切看起來很自然。這也是我喜歡使用960的原因之一。

在上面的例子中,我們遇到了個問題,現在我們就來解決它。

問題是,每一列都有左右邊距。而嵌套的三列中,第一列和最后一列是不需要邊距的,解決方法是:

  1. < div class = "container_12" >
  2. < div class = "grid_2" > sidebar </ div >
  3. < div class = "grid_10" >
  4. < div class = "grid_6alpha" > maincontent </ div >
  5. < div class = "grid_2" > photo’s </ div >
  6. < div class = "grid_2omega" > advertisement </ div >
  7. </ div >
  8. </ div >

我們可以簡單的添加” alpha “樣式來去掉左邊的間距,添加“ omega ”樣式來去除右邊的間距。這樣我們剛剛創建的這個例子在任何瀏覽器里面就很完美了(當然包括IE6)。

樣式

好了,你現在已經完全了解如果用960框架來創建一個網格布局的基本原理了。當然,我們也可以添加一些樣式到我們的布局中。

  1. < div class = "container_12" >
  2. < div id = "sidebar" class = "grid_2" > sidebar </ div >
  3. < div id = "content" class = "grid_10" >
  4. < div id = "main_content" class = "grid_6alpha" > maincontent </ div >
  5. < div id = "photo" class = "grid_2" > photo’s </ div >
  6. < div id = "advertise" class = "grid_2omega" > advertisement </ div >
  7. </ div >
  8. </ div >

因為CSS使用特性來確定哪一個樣式聲明具有高于其它樣式的優先級。” id “比 class 更重要。

用這種方法,我們可以在自己的文件中重寫那些被class設定的規則(比如寬度,padding,邊框等)。


補充

以下是我做的一個簡單的測試頁面,代碼如下:

  1. <!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. < html xmlns = "http://www.w3.org/1999/xhtml" >
  3. < head >
  4. < meta http-equiv = "Content-Type" content = "text/html;charset=gb2312" />
  5. < title > TESTPage </ title >
  6. < link href = "css/960.css" rel = "stylesheet" type = "text/css" />
  7. < link href = "css/reset.css" rel = "stylesheet" type = "text/css" />
  8. < link href = "css/text.css" rel = "stylesheet" type = "text/css" />
  9. </ head >
  10. < body >
  11. < div class = "container_16" >
  12. < div class = "grid_8" style = "background-color:#FF0000" >
  13. < div class = "grid_6omega" style = "background-color:#0000FF" > 0 </ div >
  14. < div class = "grid_2omega" style = "background-color:#FF00FF" > 00 </ div >
  15. </ div >
  16. < div class = "grid_4" style = "background-color:#00FF00" > a </ div >
  17. < div class = "grid_2" style = "background-color:#666666" > b </ div >
  18. < div class = "grid_2" style = "background-color:#666666" > c </ div >
  19. </ div >
  20. </ body >
  21. </ html >

以下是960官方的實例文檔,可以看看它的網格是如何寫的:

  1. <!--2009-From-http://travisisaacs.com/-->
  2. <!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. < html xmlns = "http://www.w3.org/1999/xhtml" dir = "ltr" lang = "en-US" >
  4. < head profile = "http://gmpg.org/xfn/11" >
  5. < meta http-equiv = "Content-Type" content = "text/html;charset=UTF-8" />
  6. < title > TravisIsaacs|MyLifeInPixels </ title >
  7. < meta name = "keywords" content = "photoshop,wordpress,userexperience,ux,uxd,ixd,interactiondesigner,interactiondesign,keynote,powerpoint,xhtml,css,webdesign,mac,timemachine,superduper,backup,aperture,canon,40d,viewzi,viewmix,views,lensrentals,lensrentals.com,infinitescrolling,cameralensrentaldallas" />
  8. < link rel = "stylesheet" href = "http://css.travisisaacs.com/2009/style.css" media = "all" />
  9. <!--[ifIE] >
  10. < link rel = "stylesheet" href = "http://css.travisisaacs.com/2009/ie.css" media = "all" />
  11. <![endif]-- >
  12. < link rel = "alternate" type = "application/rss+xml" title = "TravisIsaacs|MyLifeInPixelsRSSFeed" href = "http://travisisaacs.com/feed/" />
  13. < link rel = "pingback" href = "http://travisisaacs.com/xmlrpc.php" />
  14. < link rel = "shortcuticon" href = "http://travisisaacs.com/favicon.ico" />
  15. </ head >
  16. < body id = "TheIsaacsFamilyChristmasCard" >
  17. < div id = "header" >
  18. < div class = "container_12" >
  19. < a href = "http://travisisaacs.com" id = "return-home" title = "Gobacktothehomepage" > Thework < span class = "amp" > & </ span > thoughtsof < strong > TravisB.Isaacs </ strong > </ a >
  20. < ul id = "navigation" >
  21. < li id = "tab-work" > < a href = "http://travisisaacs.com/work/" > Work </ a > </ li >
  22. < li id = "tab-blog" > < a href = "http://travisisaacs.com/thoughts/" > Thoughts </ a > </ li >
  23. < li id = "tab-photography" > < a href = "http://travisisaacs.com/photography/" > Photography </ a > </ li >
  24. < li id = "tab-about" > < a href = "http://travisisaacs.com/about/" > About </ a > </ li >
  25. < li id = "tab-contact" > < a href = "http://travisisaacs.com/contact/" > Contact </ a > </ li >
  26. < li id = "tab-search" > < script type = "text/javascript" language = "Javascript" src = "http://vfp.viewzi.com/includes/879F-4A21-011D.js" > </ script > </ li >
  27. </ ul >
  28. </ div >
  29. </ div >
  30. < div class = "ie-center" > <!--closedinfooter-->
  31. < div class = "container_12" >
  32. < div id = "super" >
  33. < h1 > Hello.I'm < a href = "http://travisisaacs.com/about/" > TravisIsaacs </ a > ,andIdesigngreatuserexperiences. </ h1 >
  34. </ div >
  35. < div id = "content" >
  36. < div id = "recent-post" class = "grid_8alpha" >
  37. < div class = "post" >
  38. < h2 >
  39. < a href = "http://travisisaacs.com/2008/12/13/the-isaacs-family-christmas-card/" rel = "bookmark" title = "PermanentLinktoTheIsaacsFamilyChristmasCard" >
  40. TheIsaacsFamilyChristmasCard </ a >
  41. </ h2 >
  42. < div class = "post-date" >
  43. Dec13th//
  44. < span class = "comment-count" >
  45. 11comments </ span >
  46. </ div >
  47. < p > WhenplanningourfamilyChristmascardthisyear,mywifeandIdiscusstheoptionofhiringaprofessionalphotographertotakephotosofourdaughter.However,wethoughtitwouldbemuchmorefunandrewardingtodoitourselves. </ p >
  48. < a href = "http://travisisaacs.com/2008/12/13/the-isaacs-family-christmas-card/" rel = "bookmark" title = "PermanentLinktoTheIsaacsFamilyChristmasCard" > < strong > Keepreading? </ strong > </ a >
  49. </ div > <!--/post-->
  50. </ div > <!--/recent-post-->
  51. < div id = "recent-work" class = "grid_4omega" >
  52. < div class = "m_group" id = "hello" >
  53. < p > I'mTravisIsaacs,adesignerwhodabblesincode,informationarchitecture,andinteractiondesign. < a href = "http://travisisaacs.com/about/" > Moreaboutme </ a > </ p >
  54. </ div >
  55. < a href = "http://travisisaacs.com/feed/" id = "subscribe" > Subscribe </ a >
  56. </ div >
  57. < div class = "clear" > </ div >
  58. < h2 > FeaturedWork </ h2 >
  59. < a href = "http://travisisaacs.com/work/projects/tattoo-information-form/" id = "featured-work-img" title = "Viewthisproject" >
  60. < img src = "http://img.travisisaacs.com/2009/featured-work-large.jpg" alt = "featuredwork:tattoinformationsheet" />
  61. </ a >
  62. < div class = "clear" > </ div >
  63. </ div > <!--/content-->
  64. < div class = "clear" > </ div >
  65. </ div > <!--/container12-->
  66. < div class = "clear" > </ div >
  67. < div class = "clear" > </ div >
  68. < div id = "footer" class = "container_12" >
  69. < ul >
  70. < li > < a href = "http://travisisaacs.com" > Home </ a > </ li >
  71. < li > < a href = "http://travisisaacs.com/work/" > Work </ a > </ li >
  72. < li > < a href = "http://travisisaacs.com/thoughts/" > Thoughts </ a > </ li >
  73. < li > < a href = "http://travisisaacs.com/photography/" > Photography </ a > </ li >
  74. < li > < a href = "http://travisisaacs.com/about/" > About </ a > </ li >
  75. < li > < a href = "http://travisisaacs.com/contact/" > Contact </ a > </ li >
  76. </ ul >
  77. < div class = "copyright" > ?2008TravisIsaacs.AllRightsReserved. </ div >
  78. </ div >
  79. </ div > <!---/ie-center-->
  80. < script type = "text/javascript" >
  81. var gaJsHost =(("https:"==document.location.protocol)?"https://ssl.":"http://www.");
  82. document.write(unescape("%3Cscript src = '"+gaJsHost+"google-analytics.com/ga.js' type = 'text/javascript' %3E%3C/script%3E"));
  83. </ script >
  84. < script type = "text/javascript" >
  85. try{
  86. var pageTracker = _gat ._getTracker("UA-703764-4");
  87. pageTracker._trackPageview();
  88. }catch(err){} </ script >
  89. <!--WoopraCodeStart-->
  90. < script type = "text/javascript" >
  91. var _wh =(( document.location.protocol =='https:')?"https://sec1.woopra.com":"http://static.woopra.com");
  92. document.write(unescape("%3Cscript src = '"+_wh+"/js/woopra.js' type = 'text/javascript' %3E%3C/script%3E"));
  93. </ script >
  94. <!--WoopraCodeEnd-->
  95. </ body >
  96. </ html >



<!--新Google 468*60橫幅廣告開始--><script type="text/javascript"><!-- google_ad_client = "pub-7343546549496470"; /* 468x60, 創建于 08-8-6 */ google_ad_slot = "7368701459"; google_ad_width = 468; google_ad_height = 60; //--> </script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script><!--新Google 468*60橫幅廣告結束-->

<!--新Google 468x15 橫鏈接單元開始--><script type="text/javascript"><!-- google_ad_client = "pub-7343546549496470"; /* 468x15 橫鏈接單元 */ google_ad_slot = "5785741422"; google_ad_width = 468; google_ad_height = 15; //--> </script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script><!--新Google 468x15 橫鏈接單元結束-->

<!-- Google Reader shared發布代碼開始 --><script type="text/javascript" src="http://www.google.com/reader/ui/publisher.js"></script><script type="text/javascript" src="http://www.google.com/reader/public/javascript/user/00697638153916680411/state/com.google/broadcast?n=5&amp;callback=GRC_p(%7Bc%3A%22green%22%2Ct%3A%22%5Cu8FD9%5Cu4E9B%5Cu6587%5Cu7AE0%5Cu4E5F%5Cu503C%5Cu5F97%5Cu4E00%5Cu770B%22%2Cs%3A%22false%22%7D)%3Bnew%20GRC"></script><!-- Google Reader shared發布代碼結束 -->

使用960網格系統(960 Grid System)設計網頁


更多文章、技術交流、商務合作、聯系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦!!!

發表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 欧美精品一区二区蜜臀亚洲 | 欧美片网站免费 | 手机在线一区二区三区 | 五月天综合网 | 精品一区久久 | 成人欧美一区二区三区视频xxx | 99热久久这里只有精品99 | 国产午夜三级一区二区三桃花影视 | 亚洲欧美中文日韩在线v日本 | 国产视频日本 | 一级女性黄色生活片 | 欧美日剧在线免费 | 日韩精品片 | 99久久免费视频在线观看 | 奇米影视4色 | 成年人黄网站 | 天天夜夜人人 | 男女在线网站 | a黄视频 | 精品欧美乱码久久久久久 | 欧美第一区 | 激情综合激情五月 | 成人毛片免费视频播放 | 欧美日韩国产综合网 | 国产精品成人在线 | 午夜99| 在线观看国产日韩欧美 | 国产午夜精品一区二区三区嫩草 | 日本午夜视频 | 欧美日韩免费观看视频 | 一区二区三区在线免费观看 | chinese xxxxhd videos麻豆| 91国内外精品自在线播放 | 国产成人禁片免费观看 | 久久精品免费视频观看 | 国产合集福利视频在线视频 | 欧美福利 | 亚洲欧美视频 | 日韩三级欧美 | 91短视频版在线观看www免费 | 色网址在线|