PURE.CSS提供pure網(wǎng)格概念有兩種類型,pure-g,網(wǎng)格類和單元類,pure-u- *。以下是使用純網(wǎng)格的規(guī)則。
單位寬度是分?jǐn)?shù)。例如,純的pure-u-1-2表示1/2或50%的寬度,pure-u-2-5表示2/5或40%的寬度等等。
pure網(wǎng)格的子元素(具有pure-g類的元素)必須使用pure-u或者pure-u-*類名。
所有內(nèi)容應(yīng)該是要正確呈現(xiàn)網(wǎng)格單元的一部分。
pure網(wǎng)格配備了第五和第24單元兩個(gè)尺寸。下面的圖示示出了其中一些可以被附加到pure-ui-可用單位的例子。例如,創(chuàng)造50%的寬度的單元格,則可以使用一個(gè)CSS樣式pure-ui-1-2。
基于5s的單位
purecss_5th_based.htm
<html> <head> <title>The PURE.CSS Grid</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://yui.yahooapis.com/pure/0.6.0/pure-min.css"> <link rel="stylesheet" href="https://yui.yahooapis.com/pure/0.6.0/grids-responsive-min.css"> <style> .grids-example { background: rgb(250, 250, 250); margin: 2em auto; font-family: Consolas, 'Liberation Mono', Courier, monospace; text-align: center; } .grid-unit { margin: 0.25em 0; padding-left: 4.5em; } .grid-unit .grid-unit-width { font-family: Consolas, 'Liberation Mono', Courier, monospace; } .grid-unit-bar { height: 2em; background: #eee; } </style> </head> <body> <div class="grids-example"> <div class="grid-unit pure-g"> <div class="grid-unit-width pure-u">1-5</div> <div class="grid-unit-details pure-u-1"> <div class="pure-g"> <div class="grid-unit-bar pure-u-1-5"></div> </div> </div> </div> <div class="grid-unit pure-g"> <div class="grid-unit-width pure-u">2-5</div> <div class="grid-unit-details pure-u-1"> <div class="pure-g"> <div class="grid-unit-bar pure-u-2-5"></div> </div> </div> </div> <div class="grid-unit pure-g"> <div class="grid-unit-width pure-u">3-5</div> <div class="grid-unit-details pure-u-1"> <div class="pure-g"> <div class="grid-unit-bar pure-u-3-5"></div> </div> </div> </div> <div class="grid-unit pure-g"> <div class="grid-unit-width pure-u">4-5</div> <div class="grid-unit-details pure-u-1"> <div class="pure-g"> <div class="grid-unit-bar pure-u-4-5"></div> </div> </div> </div> <div class="grid-unit pure-g"> <div class="grid-unit-width pure-u">1</div> <div class="grid-unit-details pure-u-1"> <div class="pure-g"> <div class="grid-unit-bar pure-u-1"></div> </div> </div> </div> <div class="grid-unit pure-g"> <div class="grid-unit-width pure-u">1-1</div> <div class="grid-unit-details pure-u-1"> <div class="pure-g"> <div class="grid-unit-bar pure-u-1-1"></div> </div> </div> </div> </div> </body> </html>
purecss_24th_based.htm
<html> <head> <title>The PURE.CSS Grid</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://yui.yahooapis.com/pure/0.6.0/pure-min.css"> <link rel="stylesheet" href="https://yui.yahooapis.com/pure/0.6.0/grids-responsive-min.css"> <style> .grids-example { background: rgb(250, 250, 250); margin: 2em auto; font-family: Consolas, 'Liberation Mono', Courier, monospace; text-align: center; } .grid-unit { margin: 0.25em 0; padding-left: 4.5em; } .grid-unit .grid-unit-width { font-family: Consolas, 'Liberation Mono', Courier, monospace; } .grid-unit-bar { height: 2em; background: #eee; } </style> </head> <body> <div class="grids-example"> <div class="grid-unit pure-g"> <div class="grid-unit-width pure-u">1-24</div> <div class="grid-unit-details pure-u-1"> <div class="pure-g"> <div class="grid-unit-bar pure-u-1-24"></div> </div> </div> </div> <div class="grid-unit pure-g"> <div class="grid-unit-width pure-u">1-12</div> <div class="grid-unit-details pure-u-1"> <div class="pure-g"> <div class="grid-unit-bar pure-u-1-12"></div> </div> </div> </div> <div class="grid-unit pure-g"> <div class="grid-unit-width pure-u">2-24</div> <div class="grid-unit-details pure-u-1"> <div class="pure-g"> <div class="grid-unit-bar pure-u-2-24"></div> </div> </div> </div> <div class="grid-unit pure-g"> <div class="grid-unit-width pure-u">3-24</div> <div class="grid-unit-details pure-u-1"> <div class="pure-g"> <div class="grid-unit-bar pure-u-3-24"></div> </div> </div> </div> <div class="grid-unit pure-g"> <div class="grid-unit-width pure-u">1-8</div> <div class="grid-unit-details pure-u-1"> <div class="pure-g"> <div class="grid-unit-bar pure-u-1-8"></div> </div> </div> </div> <div class="grid-unit pure-g"> <div class="grid-unit-width pure-u">4-24</div> <div class="grid-unit-details pure-u-1"> <div class="pure-g"> <div class="grid-unit-bar pure-u-4-24"></div> </div> </div> </div> <div class="grid-unit pure-g"> <div class="grid-unit-width pure-u">1-6</div> <div class="grid-unit-details pure-u-1"> <div class="pure-g"> <div class="grid-unit-bar pure-u-1-6"></div> </div> </div> </div> <div class="grid-unit pure-g"> <div class="grid-unit-width pure-u">5-24</div> <div class="grid-unit-details pure-u-1"> <div class="pure-g"> <div class="grid-unit-bar pure-u-5-24"></div> </div> </div> </div> <div class="grid-unit pure-g"> <div class="grid-unit-width pure-u">1-4</div> <div class="grid-unit-details pure-u-1"> <div class="pure-g"> <div class="grid-unit-bar pure-u-1-4"></div> </div> </div> </div> <div class="grid-unit pure-g"> <div class="grid-unit-width pure-u">6-24</div> <div class="grid-unit-details pure-u-1"> <div class="pure-g"> <div class="grid-unit-bar pure-u-6-24"></div> </div> </div> </div> <div class="grid-unit pure-g"> <div class="grid-unit-width pure-u">7-24</div> <div class="grid-unit-details pure-u-1"> <div class="pure-g"> <div class="grid-unit-bar pure-u-7-24"></div> </div> </div> </div> <div class="grid-unit pure-g"> <div class="grid-unit-width pure-u">1-3</div> <div class="grid-unit-details pure-u-1"> <div class="pure-g"> <div class="grid-unit-bar pure-u-1-3"></div> </div> </div> </div> <div class="grid-unit pure-g"> <div class="grid-unit-width pure-u">22-24</div> <div class="grid-unit-details pure-u-1"> <div class="pure-g"> <div class="grid-unit-bar pure-u-22-24"></div> </div> </div> </div> <div class="grid-unit pure-g"> <div class="grid-unit-width pure-u">23-24</div> <div class="grid-unit-details pure-u-1"> <div class="pure-g"> <div class="grid-unit-bar pure-u-23-24"></div> </div> </div> </div> <div class="grid-unit pure-g"> <div class="grid-unit-width pure-u">1</div> <div class="grid-unit-details pure-u-1"> <div class="pure-g"> <div class="grid-unit-bar pure-u-1"></div> </div> </div> </div> <div class="grid-unit pure-g"> <div class="grid-unit-width pure-u">1-1</div> <div class="grid-unit-details pure-u-1"> <div class="pure-g"> <div class="grid-unit-bar pure-u-1-1"></div> </div> </div> </div> <div class="grid-unit pure-g"> <div class="grid-unit-width pure-u">24-24</div> <div class="grid-unit-details pure-u-1"> <div class="pure-g"> <div class="grid-unit-bar pure-u-24-24"></div> </div> </div> </div> </div> </body> </html>
更多建議: