Home  >  Article  >  Web Front-end  >  CSS框架BluePrint_html/css_WEB-ITnose

CSS框架BluePrint_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 11:51:271384browse

做惯了后台程序的我们,是否对前端编程有兴趣么,通过CSS框架,使我们很容易的开发出基于Div+CSS布局的页面来,今天让我们了解下大名鼎鼎的blueprint CSS框架吧!

 

它的官方网站:http://www.blueprintcss.org/

 

首先你应该申明好CSS,这很简单,通过在页面的head区域加入如下引用即可:

 

 

Html代码  

  1.   
  2.     
  3.   

 

blueprint为我们提供了grid,form,print,reset,typography等多种css文件,我们重点来了解下布局。

 

在默认情况下,以950px作为宽度,比如我们可以利用如下代码,表示950px的居中Div:

 

 

Html代码  

  1.   
  2. lt;p>Here's my site!  
  

 

你可以通过span-x来进行容器内列的定义,比如我们需要实现常见的顶部,main区域3列布局,可利用如下代码:

 

 

Html代码  

  1.   
  2.     
      
  3.         顶部  
  4.     
  
  •     
      
  •         左侧边栏  
  •     
  •   
  •     
      
  •         主体  
  •     
  •   
  •     
      
  •         右侧边栏  
  •     
  •       
  •   
  •  span-x的命名规则是指定了宽度,每个span-x比前一个增加40px,起始值为30px,可在grid.css文件中找到如下定义:

     

     

    Html代码  

    1. /* Use these classes to set the width of a column. */  
    2. .span-1 {width: 30px;}  
    3. .span-2 {width: 70px;}  
    4. .span-3 {width: 110px;}  
    5. ......  
    6. .span-23 {width: 910px;}  
    7. .span-24, div.span-24 { width: 950px; margin-right: 0; }  

     

    容器内列的定义是也许嵌套的,比如如下的代码我们定了了一个顶部,中部,顶部布局,其中中部分为左侧,中侧和右侧布局,中侧包括上下布局,代码如下:

     

     

    Html代码  

    1.   
    2.     
        
    3.         Header  
    4.     
    5.   
    6.     
        
    7.         Left sidebar  
    8.     
    9.   
    10.       
    11.     
        
    12.         
        
    13.             Box1  
    14.         
    15.   
    16.         
        
    17.             Box2  
    18.         
    19.   
    20.         
        
    21.             Box3  
    22.         
    23.   
    24.         
        
    25.             Main content  
    26.         
    27.   
    28.     
    29.   
    30.       
    31.     
        
    32.         Right sidebar  
    33.     
    34.   
    35.     
        
    36.         Footer  
    37.     
    38.   
    39.   
     

    在所有的布局中,请注意:在一个容器内最后一列的定义要加上last,确保一行中的span-x的定义的值总和要超过24,想要了解更多,可以直接下载附件中blueprint的框架包,里面附有完整的综合性的例子。

     

    感觉对新手来说,还算一个不错的CSS框架。

     

  • joshuaclayton-blueprint-css-v0.9.1-0-g9be6857.zip (3.9 MB)
  • Statement:
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
    Previous article:页面之间传值的方式_html/css_WEB-ITnoseNext article:css 中类叠加相同属性的取值问题_html/css_WEB-ITnose

    Related articles

    See more