Quick start tutorial
Welcome to this tutorial on Blueprint. It will give you a thorough intro to what you can do with the framework, and a few notes on what you shouldn’t do with it. Let’s get started.
About Blueprint
Blueprint is a CSS framework, designed to cut down on your development time. It gives you a solid foundation to build your CSS on top of, including some sensible default typography, a customizable grid, a print stylesheet and much more.
However, BP is not a silver bullet, and it’s best suited for websites where each page may require its own design. Take a look at existing BP pages before deciding if the framework is right for you. You may also check out the test files in the tests directory, which demonstrates most of the features in Blueprint.
The word “framework” may be a bit misleading in this context, since BP does not make suggestions on how you should organize or write your CSS. It’s more like a “css toolbox” with helpful bits and pieces, from which you may pick and choose based on your needs.
Structural Overview
From the bottom up, here are the CSS layers in Blueprint:
- CSS reset: Removes any default CSS rules set by each browser.
- Typography: Gives you some nice default typography and colors.
- Grid: Provides a set of CSS classes for making grid layouts.
The second part of Blueprint are the scripts, which let you customize most aspects of the framework, from column count and widths, to output paths and CSS class namespaces. We have two scripts:
Compressor: For compressing and customizing the source files.
Validator: For validating the Blueprint core files.
That’s the quick overview, so now we can finally get into the details. First, we’ll take a look at the CSS in Blueprint. We’ll then move on to the scripts, where I’ll show you how to customize the framework.
Setting Up Blueprint To use Blueprint, you must include three files in your HTML:
blueprint/screen.css: All CSS for screen, projection viewing. blueprint/print.css: A basic stylesheet for printing. blueprint/ie.css: A few needed corrections for Internet Explorer To include them, use the following HTML (make sure the href paths are correct):
<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]-->
Remember to add trailing slashes if you’re using XHTML (" />").
Using the CSS in Blueprint
As mentioned before, there’s basically three layers of CSS in Blueprint. The first two layers, the browser CSS reset and the default typography, apply themselves by changing the CSS of standard HTML elements. In other words, you don’t need to change anything in these files. If you, for instance, want to change the font size, do this in your own stylesheet, so that it’s easy to upgrade Blueprint when new versions arrive.
Classes for Typography
While the typography of Blueprint mainly applies itself, there’s a few classes provided. Here’s a list of their names and what they do:
.small
Makes the text of this element smaller.
.large
Makes the text of this element larger.
.hide
Hides an element.
.quiet
Tones down the font color for this element.
.loud
Makes this elements text black.
.highlight
Adds a yellow background to the text.
.added
Adds green background to the text.
.removed
Adds red background to the text.
.first
Removes any left sided margin/padding from the element.
.last
Removes any right sided margin/padding from the element.
.top
Removes any top margin/padding from the element.
.bottom
Removes any bottom margin/padding from the element.
Styling Forms
To make Blueprint style your input elements, each text input element should have the class .text, or .title, where .text is the normal size, and .title gives you an input field with larger text.
There’s also a few classes you may use for success and error messages:
div.error
Creates an error box (red).
div.notice
Creates a box for notices (yellow).
div.success
Creates a box for success messages (green).
Creating a Grid
The third layer is the grid CSS classes, which is the tool Blueprint gives you to create almost any kind of grid layout for your site. Keep in mind that most of the CSS behind the grid can be customized (explained below). In this section however, I’m using the default settings.
The default grid is made up of 24 columns, each spanning 30px, with a 10px margin between each column. The total width comes to 950px, which is a good width for 1024×768 resolution displays. If you’re interested in a narrower design, see the section on customizing the grid, below.
So how do you set up a grid? By using classes provided by Blueprint. To create a column, make a new <div/>
, and apply one of the .span-x classes to it. For instance, if you want a 3-column setup, with two narrow and one wide column, a header and a footer here’s how you do it:
<div class="container">
<div class="span-24">
The header
</div>
<div class="span-4">
The first column
</div>
<div class="span-16">
The center column
</div>
<div class="span-4 last">
The last column
</div>
<div class="span-24">
The footer
</div>
</div>
In addition to the spans, there are two important classes you need to know about. First of all, every Blueprint site needs to be wrapped in a div with the class .container, which is usually placed right after the body tag.
Second, the last column in a row (which by default has 24 columns), needs the class .last to remove its right hand margin. Note, however, that each .span-24 does not need the .last class, since these always span the entire width of the page.
To create basic grids, this is all you need to know. The grid CSS however, provides many more classes for more intricate designs. To see some of them in action, check out the files in tests/parts/. These files demonstrate what’s possible with the grid in Blueprint.
Here’s a quick overview of the other classes you can use in to make your grid:
.append-x
Appends x number of empty columns after a column.
.prepend-x
Prepends x number of empty columns before a column.
.push-x
Pushes a column x columns to the left. Can be used to swap columns.
.pull-x
Pulls a column x columns to the right. Can be used to swap columns.
.border
Applies a border to the right side of the column.
.colborder
Appends one empty column, with a border down the middle.
.clear
Makes a column drop below a row, regardless of space.
.showgrid
Add to container or column to see the grid and baseline.
In this list, x is a number from 1 through 23 for append/prepend and 1 through 24 for push/pull. These numbers will of course change if you set a new number of columns in the settings file.
Here’s another example where we have four columns of equal width, with a border between the two first and the two last columns, as well as a four column gap in the middle:
<div class="container">
<div class="span-5 border">
The first column
</div>
<div class="span-5 append-4">
The second column
</div>
<div class="span-5 border">
The third column
</div>
<div class="span-5 last">
The fourth (last) column
</div>
</div>
You may also nest columns to achieve the desired layout. Here’s a setup where we want four rectangles with two on top and two below on the first half of the page, and one single column spanning the second half of the page:
<div class="container">
<div class="span-12">
<div class="span-6">
Top left
</div>
<div class="span-6 last">
Top right
</div>
<div class="span-6">
Bottom left
</div>
<div class="span-6 last">
Bottom right
</div>
</div>
<div class="span-12 last">
Second half of page
</div>
</div>
Try this code in your browser if it is difficult to understand what it would look like. To see more examples on how to use these classes, check out /tests/parts/grid.html.
The Scripts
Blueprint comes with two scripts: one for compressing and customizing the CSS, and one for validating the core CSS files, which is handy if you’re making changes to these files.
The Validator
The validator has a fairly simple job – validate the CSS in the core BP files. The script uses a bundled version of the W3C CSS validator to accomplish this. To run it, you’ll need to have Ruby installed on your machine. You can then run the script like so: $ ruby validate.rb.
Note that there are a few validation errors shipping with Blueprint. These are known, and comes from a few CSS hacks needed to ensure consistent rendering across the vast browser field.
The Compressor
As the files you’ll include in your HTML are the compressed versions of the core CSS files, you’ll have to recompress the core if you’ve made any changes. This is what the compressor script is for.
In addition this is where you customize the grid. To customize the grid, a special settings file is used, and the new CSS is generated once you run the compressor. The new compressed files will then reflect your settings file.
To recompress, you just have to run the script. This will parse the core CSS files and output new compressed files in the blueprint folder. As with the validator, Ruby has to be installed to use this script. In the lib directory, run: $ruby compress.rb
Calling this file by itself will pull files from blueprint/src and concatenate them into three files; ie.css, print.css, and screen.css. However, argument variables can be set to change how this works. Calling $ruby compress.rb -h will reveal basic arguments you can pass to the script.
相关推荐
blueprint css 框架开发指南
【虚幻引擎4官方教程】Blueprint Time Attack Tutorial-1_高清
全套视频教程+实战: Python视频教程Flask Blueprint项目实战部署源码毕业设计 一个电影网站的设计流程
autoblog教程,听好用的。(~ o ~)~zZ 适合新手,网赚必备,居家旅行,杀人常备
烧瓶蓝图教程 使用蓝图以可扩展且智能的方式构建Flask应用。 教程: : 演示: : 入门 分两步在本地进行设置: 环境变量 用您的值替换.env.example中的值,然后将此文件重命名为.env : FLASK_APP :您的应用...
使用 Blueprint 将自定义 POJO 公开为 Apache Karaf 命令的非常简单的教程。建造 maven clean install要在 karaf 上部署: # any karaf supported way, ex.install -s file:///tmp/gogo/sample-karaf-command-with-...
本篇教程较长,建议在 Web 浏览器端浏览,体验更好。 准备工作 需要的开发环境和需要准备的与 Blueprint 一样: Unreal 4.34 以上版本 Visual Studio 或 Xcode(版本根据 Unreal 配置要求而定) 运行 Windows 7 ...
如何成为一个优秀的程序员,本教程将探讨一切关于数据挖掘、商业智能、商业分析、行业应用方面的问题
Roguelike 教程工作坊在以下位置完成 roguelike 教程: 在我完成本教程的过程中,我将在此过程中进行一些细微的调整,并在我完成它们的过程中记录它们请注意,我的 Entity-Blueprint-Manager 存储库依赖于正在积极...
Overview of using the Blueprint visual scripting system for gameplay. Gameplay Guide Overviews and examples of gameplay functionality for programmers and visual scripters. Samples and Tutorials ...
此插件允许您在Windows、Windows VR、移动Android和iOS上使用本地离线文本转换语音(TTS...它很容易与Blueprint或C++一起使用。 支持的开发平台:Windows 支持的目标构建平台:Windows 32/64、Windows VR、Android、iOS
PPT制作培训教程 目标:教您如何将已有教案转化为演示文稿,并且详细讲述了幻灯片的制作方法和一 些制作技巧,您可以充分发挥POWERPOINT的特点,把课讲得更生动、更活泼、更明白。 实例:下面给出了利用教案制作好的...
详细的教程在这里! 英文版 中文版本 建筑 构建/运行 首先,对于api-gateway和monitor-dashboard组件,您必须输入src/main/resources/webroot目录并使用bower安装前端依赖项: bower install 然后构建代码: ...
设计并生成 ORM 和 REST API - Swagger 和 API Blueprint。从数据库逆向生成 ERD。 了解更多 » Team Collaboration 团队协作 与云或自托管服务器协作。享受任务管理,设计发布和沟通等。 了解更多 »
file-puller-demo:演示带有infinispan幂等存储库的Fuse 6.3.X中的群集文件提取器级别:中级技术:Apache Camel 2.17,Blueprint,AMQ 7,JBoss Datagrid,Fuse 6.X摘要:本教程演示了如何使用Apache Camel,JBoss ...
Blueprints.Visual.Scripting.for.Unreal.Engine.2015虚幻引擎蓝图教程
坦克虚幻 关于 该存储库包含我对 ,流行游戏背后的引擎。 我主要使用C ++编写游戏,并在更容易的地方使用蓝图子类化。 该项目的目的是说明在虚幻引擎中创建共享的本地多人游戏的方法,并提供用于比较Unity和虚幻的...
:sparkles: 2018 年 10 月更新:由于我们引入了一些新功能,本教程和代码示例已更新! 与此示例的先前版本相比的所有更改,请阅读 一个有助于强制执行频道命名约定的示例应用程序。 (GIF 图像已过时,但是,此...
向新用户发送欢迎消息 :sparkles: 2019 年 12 月更新:由于我们引入了一些新功能,本教程和代码示例已更新! 与此示例的先前版本相比的所有更改,请阅读 在新用户加入团队时显示服务条款(或任何其他消息)的示例 ...
:sparkles: 2020 年 1 月更新:由于我们引入了一些新功能,因此更新了本教程和代码示例! 阅读了解更多信息! 在 3rd 方系统中创建服务台工单时,在 Slack 中发送可操作的通知,允许用户认领工单或应用标签。 ...