解读Blueprint CSS framework

来源:互联网 发布:本地音乐播放器 知乎 编辑:程序博客网 时间:2024/05/18 01:11

例子文件:Sample.html              http://www.blueprintcss.org/tests/parts/sample.html

<link rel="stylesheet" href="../../blueprint/screen.css" type="text/css" media="screen, projection">

这个文件将所有的CSS文件合并到一起,减少了并发连接数。

一共包含了以下几个CSS

/* reset.css */

/* typography.css */

/* forms.css */

/* grid.css */

此外,如果是IE8以下版本则包含/* ie.css */

  作者的注释已经很清晰了,代码也很清晰。跟着我一起理解一遍即可。

CSS代码
  1. /* --------------------------------------------------------------  
  2.     
  3.    reset.css  
  4.    * Resets default browser CSS.  
  5.      
  6. -------------------------------------------------------------- */  
  7. /*原文作者注释已经很清晰了*/  
  8.   
  9.   
  10. html, body, div, span, object, iframe,   
  11. h1, h2, h3, h4, h5, h6, p, blockquote, pre,   
  12. a, abbr, acronym, address, code,   
  13. del, dfn, em, img, q, dl, dt, dd, ol, ul, li,   
  14. fieldset, form, label, legend,   
  15. table, caption, tbody, tfoot, thead, tr, th, td {   
  16.   margin: 0;   
  17.   padding: 0;   
  18.   border: 0;   
  19.   font-weight: inherit;   
  20.   font-style: inherit;   
  21.   font-size: 100%;   
  22.   font-family: inherit;   
  23.   vertical-alignbaselinebaseline;   
  24. }   
  25. /*行高1.5,也就是150%,刚看了淘宝UED的碳酸饮料会杂志,上面有介绍*/  
  26. body {    
  27.   line-height: 1.5;    
  28. }   
  29.   
  30. /* Tables still need 'cellspacing="0"' in the markup. */  
  31. table { border-collapseseparateborder-spacing: 0; }   
  32. caption, th, td { text-alignleftfont-weightnormal; }   
  33. /*垂直居中*/  
  34. table, td, th { vertical-alignmiddle; }   
  35.   
  36. /* Remove possible quote marks (") from <q>, <blockquote>. */  
  37. blockquote:before, blockquote:after, q:before, q:after { content: ""; } 
  38. blockquote, q { quotes: "" ""; }   
  39.   
  40. /* 链接内加图片,会有一个难看的border */  
  41. a img { bordernone; }   

 

CSS代码
  1. /* --------------------------------------------------------------  
  2.  
  3.    typography.css  
  4.    * Sets up some sensible default typography.  
  5.      
  6.    typography == 文字排版  
  7.      
  8. -------------------------------------------------------------- */  
  9.   
  10. /* Default font settings.   
  11.    The font-size percentage is of 16px. (0.75 * 16px = 12px) 默认12像素 
  12.    */  
  13. body {    
  14.   font-size: 75%;   
  15.   color#222;    
  16.   background#fff;   
  17.   font-family"Helvetica Neue"ArialHelveticasans-serif;   
  18. }   
  19.   
  20.   
  21. /* Headings  
  22. -------------------------------------------------------------- */  
  23.   
  24. /*不加粗,非纯黑(将更美观)*/  
  25. h1,h2,h3,h4,h5,h6 { font-weightnormalcolor#111; }   
  26.   
  27. h1 { font-size: 3em; line-height: 1; margin-bottom: 0.5em; }   
  28. h2 { font-size: 2em; margin-bottom: 0.75em; }   
  29. h3 { font-size: 1.5em; line-height: 1; margin-bottom: 1em; }   
  30. h4 { font-size: 1.2em; line-height: 1.25; margin-bottom: 1.25em; }   
  31. /*H5 H6的字体和正文已经一样了,所以要加粗*/  
  32. h5 { font-size: 1em; font-weightboldmargin-bottom: 1.5em; }   
  33. h6 { font-size: 1em; font-weightbold; }   
  34.   
  35. h1 img, h2 img, h3 img,    
  36. h4 img, h5 img, h6 img {   
  37.   margin: 0;   
  38. }   
  39.   
  40.   
  41. /* Text elements  
  42. -------------------------------------------------------------- */  
  43.   
  44. p           { margin: 0 0 1.5em; }   
  45. p img.left  { floatleftmargin: 1.5em 1.5em 1.5em 0; padding: 0; }   
  46. p img.rightright { floatrightrightmargin: 1.5em 0 1.5em 1.5em; }   
  47.   
  48. a:focus,    
  49. a:hover     { color#000; }   
  50. a           { color#009text-decorationunderline; }   
  51.   
  52. blockquote  { margin: 1.5em; color#666font-styleitalic; }   
  53. strong      { font-weightbold; }   
  54. em,dfn      { font-styleitalic; }   
  55. dfn         { font-weightbold; }   
  56. sup, sub    { line-height: 0; }   
  57.   
  58. abbr,    
  59. acronym     { border-bottom1px dotted #666; }   
  60. address     { margin: 0 0 1.5em; font-styleitalic; }   
  61. del         { color:#666; }   
  62.   
  63. pre                 { margin: 1.5em 0; whitewhite-spacepre; }   
  64. /*代码用等宽字体*/  
  65. pre,code,tt { font: 1em 'andale mono''lucida console'monospaceline-height: 1.5; }   
  66.   
  67.   
  68. /* Lists  
  69. -------------------------------------------------------------- */  
  70.   
  71. /*和平时的做法不一样,常用的ul li是有margin的,并保留list-style*/  
  72. li ul,    
  73. li ol       { margin:0 1.5em; }   
  74. ul, ol      { margin: 0 1.5em 1.5em 1.5em; }   
  75.   
  76. ul          { list-style-typedisc; }   
  77. ol          { list-style-typedecimal; }   
  78.   
  79. dl          { margin: 0 0 1.5em 0; }   
  80. dl dt       { font-weightbold; }   
  81. dd          { margin-left: 1.5em;}   
  82.   
  83.   
  84. /* Tables  
  85. -------------------------------------------------------------- */  
  86. /*表格头加粗加背景,效果应该不错*/  
  87. table       { margin-bottom: 1.4em; width:100%; }   
  88. th          { font-weightbold; }   
  89. thead th        { background#c3d9ff; }   
  90. th,td,caption { padding4px 10px 4px 5px; }   
  91. tr.even td  { background#e5ecf9; }   
  92. tfoot       { font-styleitalic; }   
  93. caption     { background#eee; }   
  94.   
  95.   
  96. /* Misc classes  
  97. -------------------------------------------------------------- */  
  98.   
  99. .small      { font-size: .8em; margin-bottom: 1.875em; line-height: 1.875em; }   
  100. .large      { font-size: 1.2em; line-height: 2.5em; margin-bottom: 1.25em; }   
  101. .hide       { displaynone; }   
  102.   
  103. .quiet      { color#666; }   
  104. .loud       { color#000; }   
  105. .highlight  { background:#ff0; }   
  106. .added      { background:#060color#fff; }   
  107. .removed    { background:#900color#fff; }   
  108.   
  109. .first      { margin-left:0; padding-left:0; }   
  110. .last       { margin-right:0; padding-right:0; }   
  111. .top        { margin-top:0; padding-top:0; }   
  112. .bottombottom     { margin-bottom:0; padding-bottom:0; }   

 

表单

CSS代码
  1. /* --------------------------------------------------------------  
  2.  
  3.    forms.css  
  4.    * Sets up some default styling for forms  
  5.    * Gives you classes to enhance your forms 
  6.      
  7.    Usage:  
  8.    * For text fields, use class .title or .text  
  9.    * For inline forms, use .inline (even when using columns) 
  10.      
  11. -------------------------------------------------------------- */  
  12.   
  13. label       { font-weightbold; }   
  14. fieldset    { padding:1.4em; margin: 0 0 1.5em 0; border1px solid #ccc; }   
  15. legend      { font-weightboldfont-size:1.2em; }   
  16.   
  17.   
  18. /* Form fields  
  19. -------------------------------------------------------------- */  
  20. /*这种方式的selector不错*/  
  21. input[type=text], input[type=password],   
  22. input.text, input.title,    
  23. textarea, select {    
  24.   background-color:#fff;    
  25.   border:1px solid #bbb;    
  26. }   
  27. /*获取到焦点时改变边框颜色,不用JS就能实现,很实用*/  
  28. input[type=text]:focus, input[type=password]:focus,    
  29. input.text:focus, input.title:focus,    
  30. textarea:focus, select:focus {    
  31.   border-color:#666;    
  32. }   
  33.   
  34. input[type=text], input[type=password],   
  35. input.text, input.title,   
  36. textarea, select {   
  37.   margin:0.5em 0;   
  38. }   
  39.   
  40. input.text,    
  41. input.title   { width300pxpadding:5px; }   
  42. input.title   { font-size:1.5em; }   
  43. textarea      { width390pxheight250pxpadding:5px; }   
  44. /*修正checkbox和radio的位置*/  
  45. input[type=checkbox], input[type=radio],    
  46. input.checkbox, input.radio {    
  47.   position:relativetop:.25em;    
  48. }   
  49.   
  50. form.inline { line-height:3; }   
  51. form.inline p { margin-bottom:0; }   
  52.   
  53.   
  54. /* Success, notice and error boxes  
  55. -------------------------------------------------------------- */  
  56.   
  57. .error,   
  58. .notice,    
  59. .success    { padding: .8em; margin-bottom: 1em; border2px solid #ddd; }   
  60.   
  61. .error      { background#FBE3E4color#8a1f11border-color#FBC2C4; }   
  62. .notice     { background#FFF6BFcolor#514721border-color#FFD324; }   
  63. .success    { background#E6EFC2color#264409border-color#C6D880; }   
  64. .error a    { color#8a1f11; }   
  65. .notice a   { color#514721; }   
  66. .success a  { color#264409; }  

 

 

CSS代码
  1.   
  2. /* -------------------------------------------------------------- 
  3.  
  4.     grid.css  
  5.     * Sets up an easy-to-use grid of 24 columns. 
  6.       
  7.     By default, the grid is 950px wide, with 24 columns 
  8.     spanning 30px, and a 10px margin between columns.  
  9.       
  10.     If you need fewer or more columns, namespaces or semantic 
  11.     element names, use the compressor script (lib/compress.rb) 
  12.       
  13.     Note: Changes made in this file will not be applied when 
  14.     using the compressor: make changes in lib/blueprint/grid.css.rb 
  15.       
  16. -------------------------------------------------------------- */  
  17.   
  18. /* A container should group all your columns.   
  19. 容器宽950,居中  
  20. */  
  21. .container {   
  22.   width950px;   
  23.   margin: 0 auto;   
  24. }   
  25.   
  26. /* Use this class on any div.span / container to see the grid.  
  27. 显示grid  
  28. */  
  29. .showgrid {    
  30.   backgroundurl(src/grid.png);    
  31. }   
  32.   
  33.   
  34. /* Columns  
  35. -------------------------------------------------------------- */  
  36.   
  37. /* Sets up basic grid floating and margin.  
  38. DIV需要float才能排一行  
  39. */  
  40. .column, div.span-1, div.span-2, div.span-3, div.span-4, div.span-5, div.span-6, div.span-7, div.span-8, div.span-9, div.span-10, div.span-11, div.span-12, div.span-13, div.span-14, div.span-15, div.span-16, div.span-17, div.span-18, div.span-19, div.span-20, div.span-21, div.span-22, div.span-23, div.span-24 {   
  41.   floatleft;   
  42.   margin-right10px;   
  43. }   
  44.   
  45. /* The last column in a row needs this class.  
  46. 右侧的column需要将右边距调为0  
  47. */  
  48. .last, div.last { margin-right: 0; }   
  49.   
  50. /* Use these classes to set the width of a column.   
  51. 最重要的部分,.span-x,为容器占用的column数  
  52. */  
  53. .span-1 {width30px;}   
  54.   
  55. .span-2 {width70px;}   
  56. .span-3 {width110px;}   
  57. .span-4 {width150px;}   
  58. .span-5 {width190px;}   
  59. .span-6 {width230px;}   
  60. .span-7 {width270px;}   
  61. .span-8 {width310px;}   
  62. .span-9 {width350px;}   
  63. .span-10 {width390px;}   
  64. .span-11 {width430px;}   
  65. .span-12 {width470px;}   
  66. .span-13 {width510px;}   
  67. .span-14 {width550px;}   
  68. .span-15 {width590px;}   
  69. .span-16 {width630px;}   
  70. .span-17 {width670px;}   
  71. .span-18 {width710px;}   
  72. .span-19 {width750px;}   
  73. .span-20 {width790px;}   
  74. .span-21 {width830px;}   
  75. .span-22 {width870px;}   
  76. .span-23 {width910px;}   
  77. .span-24, div.span-24 { width:950pxmargin:0; }   
  78.   
  79. /* Use these classes to set the width of an input. */  
  80. input.span-1, textarea.span-1, input.span-2, textarea.span-2, input.span-3, textarea.span-3, input.span-4, textarea.span-4, input.span-5, textarea.span-5, input.span-6, textarea.span-6, input.span-7, textarea.span-7, input.span-8, textarea.span-8, input.span-9, textarea.span-9, input.span-10, textarea.span-10, input.span-11, textarea.span-11, input.span-12, textarea.span-12, input.span-13, textarea.span-13, input.span-14, textarea.span-14, input.span-15, textarea.span-15, input.span-16, textarea.span-16, input.span-17, textarea.span-17, input.span-18, textarea.span-18, input.span-19, textarea.span-19, input.span-20, textarea.span-20, input.span-21, textarea.span-21, input.span-22, textarea.span-22, input.span-23, textarea.span-23, input.span-24, textarea.span-24 {   
  81.   border-left-width1px!important;   
  82.   border-right-width1px!important;   
  83.   padding-left5px!important;   
  84.   padding-right5px!important;   
  85. }   
  86.   
  87. input.span-1, textarea.span-1 { width18px!important; }   
  88. input.span-2, textarea.span-2 { width58px!important; }   
  89. input.span-3, textarea.span-3 { width98px!important; }   
  90. input.span-4, textarea.span-4 { width138px!important; }   
  91. input.span-5, textarea.span-5 { width178px!important; }   
  92. input.span-6, textarea.span-6 { width218px!important; }   
  93. input.span-7, textarea.span-7 { width258px!important; }   
  94. input.span-8, textarea.span-8 { width298px!important; }   
  95. input.span-9, textarea.span-9 { width338px!important; }   
  96. input.span-10, textarea.span-10 { width378px!important; }   
  97. input.span-11, textarea.span-11 { width418px!important; }   
  98. input.span-12, textarea.span-12 { width458px!important; }   
  99. input.span-13, textarea.span-13 { width498px!important; }   
  100. input.span-14, textarea.span-14 { width538px!important; }   
  101. input.span-15, textarea.span-15 { width578px!important; }   
  102. input.span-16, textarea.span-16 { width618px!important; }   
  103. input.span-17, textarea.span-17 { width658px!important; }   
  104. input.span-18, textarea.span-18 { width698px!important; }   
  105. input.span-19, textarea.span-19 { width738px!important; }   
  106. input.span-20, textarea.span-20 { width778px!important; }   
  107. input.span-21, textarea.span-21 { width818px!important; }   
  108. input.span-22, textarea.span-22 { width858px!important; }   
  109. input.span-23, textarea.span-23 { width898px!important; }   
  110. input.span-24, textarea.span-24 { width938px!important; }   
  111.   
  112. /* Add these to a column to append empty cols.   
  113. 这个想法很有意思,可以提高了重用度  
  114. */  
  115.   
  116. .append-1 { padding-right40px;}   
  117. .append-2 { padding-right80px;}   
  118. .append-3 { padding-right120px;}   
  119. .append-4 { padding-right160px;}   
  120. .append-5 { padding-right200px;}   
  121. .append-6 { padding-right240px;}   
  122. .append-7 { padding-right280px;}   
  123. .append-8 { padding-right320px;}   
  124. .append-9 { padding-right360px;}   
  125. .append-10 { padding-right400px;}   
  126. .append-11 { padding-right440px;}   
  127. .append-12 { padding-right480px;}   
  128. .append-13 { padding-right520px;}   
  129. .append-14 { padding-right560px;}   
  130. .append-15 { padding-right600px;}   
  131. .append-16 { padding-right640px;}   
  132. .append-17 { padding-right680px;}   
  133. .append-18 { padding-right720px;}   
  134. .append-19 { padding-right760px;}   
  135. .append-20 { padding-right800px;}   
  136. .append-21 { padding-right840px;}   
  137. .append-22 { padding-right880px;}   
  138. .append-23 { padding-right920px;}   
  139.   
  140. /* Add these to a column to prepend empty cols. */  
  141.   
  142. .prepend-1 { padding-left40px;}   
  143. .prepend-2 { padding-left80px;}   
  144. .prepend-3 { padding-left120px;}   
  145. .prepend-4 { padding-left160px;}   
  146. .prepend-5 { padding-left200px;}   
  147. .prepend-6 { padding-left240px;}   
  148. .prepend-7 { padding-left280px;}   
  149. .prepend-8 { padding-left320px;}   
  150. .prepend-9 { padding-left360px;}   
  151. .prepend-10 { padding-left400px;}   
  152. .prepend-11 { padding-left440px;}   
  153. .prepend-12 { padding-left480px;}   
  154. .prepend-13 { padding-left520px;}   
  155. .prepend-14 { padding-left560px;}   
  156. .prepend-15 { padding-left600px;}   
  157. .prepend-16 { padding-left640px;}   
  158. .prepend-17 { padding-left680px;}   
  159. .prepend-18 { padding-left720px;}   
  160. .prepend-19 { padding-left760px;}   
  161. .prepend-20 { padding-left800px;}   
  162. .prepend-21 { padding-left840px;}   
  163. .prepend-22 { padding-left880px;}   
  164. .prepend-23 { padding-left920px;}   
  165.   
  166.   
  167. /* Border on right hand side of a column.  
  168. 右侧的border,此外还会加右边距和右补白  
  169.  */  
  170. div.border {   
  171.   padding-right4px;   
  172.   margin-right5px;   
  173.   border-right1px solid #eee;   
  174. }   
  175.   
  176. /* Border with more whitespace, spans one column.  
  177. 比border空的更多 */  
  178. div.colborder {   
  179.   padding-right24px;   
  180.   margin-right25px;   
  181.   border-right1px solid #eee;   
  182. }   
  183.   
  184.   
  185. /* Use these classes on an element to push it into the  
  186. next column, or to pull it into the previous column.    
  187. 可以把元素拉回上一行或者推入下一行  
  188. */  
  189.   
  190.   
  191. .pull-1 { margin-left: -40px; }   
  192. .pull-2 { margin-left: -80px; }   
  193. .pull-3 { margin-left: -120px; }   
  194. .pull-4 { margin-left: -160px; }   
  195. .pull-5 { margin-left: -200px; }   
  196. .pull-6 { margin-left: -240px; }   
  197. .pull-7 { margin-left: -280px; }   
  198. .pull-8 { margin-left: -320px; }   
  199. .pull-9 { margin-left: -360px; }   
  200. .pull-10 { margin-left: -400px; }   
  201. .pull-11 { margin-left: -440px; }   
  202. .pull-12 { margin-left: -480px; }   
  203. .pull-13 { margin-left: -520px; }   
  204. .pull-14 { margin-left: -560px; }   
  205. .pull-15 { margin-left: -600px; }   
  206. .pull-16 { margin-left: -640px; }   
  207. .pull-17 { margin-left: -680px; }   
  208. .pull-18 { margin-left: -720px; }   
  209. .pull-19 { margin-left: -760px; }   
  210. .pull-20 { margin-left: -800px; }   
  211. .pull-21 { margin-left: -840px; }   
  212. .pull-22 { margin-left: -880px; }   
  213. .pull-23 { margin-left: -920px; }   
  214. .pull-24 { margin-left: -960px; }   
  215.   
  216. .pull-1, .pull-2, .pull-3, .pull-4, .pull-5, .pull-6, .pull-7, .pull-8, .pull-9, .pull-10, .pull-11, .pull-12, .pull-13, .pull-14, .pull-15, .pull-16, .pull-17, .pull-18, .pull-19, .pull-20, .pull-21, .pull-22, .pull-23, .pull-24 {floatleftposition:relative;}   
  217.   
  218. /*左右用像素,上下用相对定位*/  
  219. .push-1 { margin: 0 -40px 1.5em 40px; }   
  220. .push-2 { margin: 0 -80px 1.5em 80px; }   
  221. .push-3 { margin: 0 -120px 1.5em 120px; }   
  222. .push-4 { margin: 0 -160px 1.5em 160px; }   
  223. .push-5 { margin: 0 -200px 1.5em 200px; }   
  224. .push-6 { margin: 0 -240px 1.5em 240px; }   
  225. .push-7 { margin: 0 -280px 1.5em 280px; }   
  226. .push-8 { margin: 0 -320px 1.5em 320px; }   
  227. .push-9 { margin: 0 -360px 1.5em 360px; }   
  228. .push-10 { margin: 0 -400px 1.5em 400px; }   
  229. .push-11 { margin: 0 -440px 1.5em 440px; }   
  230. .push-12 { margin: 0 -480px 1.5em 480px; }   
  231. .push-13 { margin: 0 -520px 1.5em 520px; }   
  232. .push-14 { margin: 0 -560px 1.5em 560px; }   
  233. .push-15 { margin: 0 -600px 1.5em 600px; }   
  234. .push-16 { margin: 0 -640px 1.5em 640px; }   
  235. .push-17 { margin: 0 -680px 1.5em 680px; }   
  236. .push-18 { margin: 0 -720px 1.5em 720px; }   
  237. .push-19 { margin: 0 -760px 1.5em 760px; }   
  238. .push-20 { margin: 0 -800px 1.5em 800px; }   
  239. .push-21 { margin: 0 -840px 1.5em 840px; }   
  240. .push-22 { margin: 0 -880px 1.5em 880px; }   
  241. .push-23 { margin: 0 -920px 1.5em 920px; }   
  242. .push-24 { margin: 0 -960px 1.5em 960px; }   
  243.   
  244. .push-1, .push-2, .push-3, .push-4, .push-5, .push-6, .push-7, .push-8, .push-9, .push-10, .push-11, .push-12, .push-13, .push-14, .push-15, .push-16, .push-17, .push-18, .push-19, .push-20, .push-21, .push-22, .push-23, .push-24 {floatrightrightposition:relative;}   
  245.   
  246.   
  247. /* Misc classes and elements  
  248. -------------------------------------------------------------- */  
  249.   
  250. /* In case you need to add a gutter above/below an element */  
  251. .prepend-top {    
  252.   margin-top:1.5em;    
  253. }   
  254. .append-bottombottom {    
  255.   margin-bottom:1.5em;    
  256. }   
  257.   
  258. /* Use a .box to create a padded box inside a column.  */    
  259. .box {    
  260.   padding: 1.5em;    
  261.   margin-bottom: 1.5em;    
  262.   background#E5ECF9;    
  263. }   
  264.   
  265. /* Use this to create a horizontal ruler across a column. */  
  266. hr {   
  267.   background#ddd;    
  268.   color#ddd;   
  269.   clearboth;    
  270.   floatnone;    
  271.   width: 100%;    
  272.   height: .1em;   
  273.   margin: 0 0 1.45em;   
  274.   bordernone;    
  275. }   
  276. hr.space {   
  277.   background#fff;   
  278.   color#fff;   
  279. }   
  280.   
  281.   
  282. /* Clearing floats without extra markup  
  283.    Based on How To Clear Floats Without Structural Markup by PiE 
  284.    [http://www.positioniseverything.net/easyclearing.html] */  
  285.   
  286. .clearfix:after, .container:after {   
  287.   content"\0020";    
  288.   displayblock;    
  289.   height: 0;    
  290.   clearboth;    
  291.   visibilityhidden;   
  292.   overflow:hidden;    
  293. }   
  294. .clearfix, .container {displayblock;}   
  295.   
  296. /* Regular clearing  
  297.    apply to column that should drop below previous ones. */  
  298.   
  299. .clear { clear:both; }   

 

 

CSS代码
  1. /* --------------------------------------------------------------  
  2.      
  3.    ie.css  
  4.      
  5.    Contains every hack for Internet Explorer, 
  6.    so that our core files stay sweet and nimble.  
  7.      
  8.      
  9.    IE问题集  - -  
  10.    可以解决好多莫名其妙的IE兼容性问题  
  11. -------------------------------------------------------------- */  
  12.   
  13. /* Make sure the layout is centered in IE5  
  14. 兼容IE5...*/  
  15. body { text-aligncenter; }   
  16. .container { text-alignleft; }   
  17.   
  18. /* Fixes IE margin bugs */  
  19. * html .column, * html div.span-1, * html div.span-2,    
  20. * html div.span-3, * html div.span-4, * html div.span-5,    
  21. * html div.span-6, * html div.span-7, * html div.span-8,    
  22. * html div.span-9, * html div.span-10, * html div.span-11,    
  23. * html div.span-12, * html div.span-13, * html div.span-14,    
  24. * html div.span-15, * html div.span-16, * html div.span-17,    
  25. * html div.span-18, * html div.span-19, * html div.span-20,    
  26. * html div.span-21, * html div.span-22, * html div.span-23,    
  27. * html div.span-24 { overflow-x: hidden; }   
  28.   
  29.   
  30. /* Elements  
  31. -------------------------------------------------------------- */  
  32.   
  33. /* Fixes incorrect styling of legend in IE6. */  
  34. * html legend { margin:0px -8px 16px 0; padding:0; }   
  35.   
  36. /* Fixes incorrect placement of ol numbers in IE6/7. */  
  37. ol { margin-left:2em; }   
  38.   
  39. /* Fixes wrong line-height on sup/sub in IE. */  
  40. sup { vertical-aligntext-top; }   
  41. sub { vertical-aligntext-bottom; }   
  42.   
  43. /* Fixes IE7 missing wrapping of code elements. */  
  44. html>body p code { *whitewhite-spacenormal; }    
  45.   
  46. /* IE 6&7 has problems with setting proper <hr> margins. */  
  47. hr  { margin: -8px auto 11px; }   
  48.   
  49. /* Explicitly set interpolation, allowing dynamically resized images to not look horrible */  
  50. img { -ms-interpolation-mode: bicubic; }   
  51.   
  52. /* Clearing   
  53. -------------------------------------------------------------- */  
  54.   
  55. /* Makes clearfix actually work in IE */    
  56. .clearfix, .container {displayinline-block;}   
  57. * html .clearfix,   
  58. * html .container {height: 1%;}   
  59.   
  60.   
  61. /* Forms   
  62. -------------------------------------------------------------- */  
  63.   
  64. /* Fixes padding on fieldset */  
  65. fieldset {padding-top: 0;}   
  66.   
  67. /* Fixes rule that IE 6 ignores */  
  68. input.text, input.title {background-color:#fff;border:1px solid #bbb;}   
  69. input.text:focus, input.title:focus {border-color:#666;}   
  70. input.text, input.title, textarea, select {margin:0.5em 0;}   
  71. input.checkbox, input.radio {position:relativetop:.25em;}   
  72.   
  73. /* Fixes alignment of inline form elements */    
  74. form.inline div, form.inline p {vertical-align:middle;}   
  75. form.inline label {position:relative;top:-0.25em;}   
  76. form.inline input.checkbox, form.inline input.radio,   
  77. form.inline input.button, form.inline button {    
  78.   margin:0.5em 0;    
  79. }   
  80. button, input.button {position:relative;top:0.25em;}  

 

为打印作优化

 

CSS代码
  1. /* --------------------------------------------------------------  
  2.  
  3.    print.css  
  4.    * Gives you some sensible styles for printing pages. 
  5.    * See Readme file in this directory for further instructions. 
  6.         
  7.    Some additions you'll want to make, customized to your markup: 
  8.    #header, #footer, #navigation { display:none; }  
  9.      
  10. -------------------------------------------------------------- */  
  11.   
  12. body {   
  13.   line-height: 1.5;   
  14.   font-family"Helvetica Neue"ArialHelveticasans-serif;   
  15.   color:#000;   
  16.   backgroundnone;   
  17.   font-size10pt;   
  18. }   
  19.   
  20.   
  21. /* Layout  
  22. -------------------------------------------------------------- */  
  23. /*除去背景*/  
  24. .container {   
  25.   backgroundnone;   
  26. }   
  27. /*加深水平线*/  
  28. hr {    
  29.   background:#ccc;    
  30.   color:#ccc;   
  31.   width:100%;   
  32.   height:2px;   
  33.   margin:2em 0;   
  34.   padding:0;   
  35.   border:none;   
  36. }   
  37. hr.space {   
  38.   background#fff;   
  39.   color#fff;   
  40. }   
  41.   
  42.   
  43. /* Text  
  44. -------------------------------------------------------------- */  
  45. /*这样的字体在印刷物上更清晰*/  
  46. h1,h2,h3,h4,h5,h6 { font-family"Helvetica Neue"Arial"Lucida Grande"sans-serif; }   
  47. code { font:.9em "Courier New", Monaco, Courier, monospace; }    
  48.   
  49. img { float:leftmargin:1.5em 1.5em 1.5em 0; }   
  50. a img { border:none; }   
  51. p img.top { margin-top: 0; }   
  52.   
  53. blockquote {   
  54.   margin:1.5em;   
  55.   padding:1em;   
  56.   font-style:italic;   
  57.   font-size:.9em;   
  58. }   
  59.   
  60. .small  { font-size: .9em; }   
  61. .large  { font-size: 1.1em; }   
  62. .quiet  { color#999; }   
  63. .hide   { display:none; }   
  64.   
  65.   
  66. /* Links  
  67. -------------------------------------------------------------- */  
  68. /*为链接加下划线*/  
  69. a:link, a:visited {   
  70.   backgroundtransparent;   
  71.   font-weight:700;   
  72.   text-decorationunderline;   
  73. }   
  74. /*显示链接的链接地址*/  
  75. a:link:after, a:visited:after {   
  76.   content" (" attr(href) ")";   
  77.   font-size: 90%;   
  78. }   
  79.   
  80. /* If you're having trouble printing relative links, uncomment and customize this: 
  81.    (note: This is valid CSS3, but it still won't go through the W3C CSS Validator)  
  82.     显示绝对地址  
  83.     但是不能通过W3C校验  
  84. */  
  85. /* a[href^="/"]:after {  
  86.   content: " (http://www.yourdomain.com" attr(href) ") "; 
  87. } */