CSS framework BluePrint and cssblueprint
If we are used to background programs, are we interested in front-end programming? Through the CSS framework, we can easily develop pages based on Div + CSS layout, let's take a look at the famous blueprint CSS framework today!
Its official website: http://www.blueprintcss.org/
First, you should declare CSS, which is very simple. Add the following reference to the header area of the page:
Html code
- <Link rel = "stylesheet" href = "css/blueprint/screen.css" type = "text/css" media = "screen, projection">
- <Link rel = "stylesheet" href = "css/blueprint/print.css" type = "text/css" media = "print">
- <! -- [If lt IE 8]> <link rel = "stylesheet" href = "css/blueprint/ie.css" type = "text/css" media = "screen, projection "> <! [Endif] -->
Blueprint provides a variety of css files, such as grid, form, print, reset, and typography. We will focus on the layout.
By default, the width is 950px. For example, we can use the following code to indicate the center Div of 950px:
Html code
- <Div class = "container">
- Lt; p> Here's my site! </P>
- </Div>
You can use span-x to define the columns in the container. For example, you need to implement a common top-level layout with three columns in the main area. You can use the following code:
Html code
- <Div class = "container" style = "border: 1px solid #000;">
- <Div class = "span-24 last">
- Top
- </Div>
- <Div class = "span-4">
- Left sidebar
- </Div>
- <Div class = "span-16">
- Subject
- </Div>
- <Div class = "span-4 last">
- Right sidebar
- </Div>
- </Div>
The naming rule of span-xdefines the width. Each span-xis increased by 40 pxcompared to the previous one, and the start value is 30px. the following definitions can be found in the grid.css file:
Html code
- /* Use these classes to set the width of a column .*/
- . Span-1 {width: 30px ;}
- . Span-2 {width: 70px ;}
- . Span-3 {width: 110px ;}
- ......
- . Span-23 {width: 910px ;}
- . Span-24, div. span-24 {width: 950px; margin-right: 0 ;}
The definition of columns in the container may be nested. For example, in the following code, we have set a top, middle, and top layout. The center is divided into the left, middle, and right layout, the middle side includes the up and down layout. The Code is as follows:
Html code
- <Div class = "container">
- <Div class = "span-24 last">
- Header
- </Div>
- <Div class = "span-4">
- Left sidebar
- </Div>
- <Div class = "span-16">
- <Div class = "span-8">
- Box1
- </Div>
- <Div class = "span-4">
- Box2
- </Div>
- <Div class = "span-4 last">
- Box3
- </Div>
- <Div class = "span-16 last">
- Main content
- </Div>
- </Div>
- <Div class = "span-4 last">
- Right sidebar
- </Div>
- <Div class = "span-24 last">
- Footer
- </Div>
- </Div>
In all la S, note that the last column of the definition in a container must be added with last. Make sure that the total number of span-x defined values in a row exceeds 24, to learn more, you can directly download the blueprint framework package in the attachment, which contains a complete and comprehensive example.
It seems like a good CSS framework for beginners.
- Joshuaclayton-blueprint-css-v0.9.1-0-g9be6857.zip (3.9 MB)