(1)标记一下:这个貌似蛮好的东西,先收着http://twitter.github.com/bootstrap/
(2)条件注释判断浏览器<!--[if !IE]><!--[if IE]><!--[if lt IE 6]><!--[if gte IE 6]>
<!--[if !IE]><!--> 除IE外都可识别 <!--<![endif]-->
<!--[if IE]> 所有的IE可识别 <![endif]-->
<!--[if IE 6]> 仅IE6可识别 <![endif]-->
<!--[if lt IE 6]> IE6以下版本可识别 <![endif]-->
<!--[if gte IE 6]> IE6以及IE6以上版本可识别 <![endif]-->
<!--[if IE 7]> 仅IE7可识别 <![endif]-->
<!--[if lt IE 7]> IE7以下版本可识别 <![endif]-->
<!--[if gte IE 7]> IE7以及IE7以上版本可识别 <![endif]-->
<!--[if IE 8]> 仅IE8可识别 <![endif]-->
<!--[if IE 9]> 仅IE9可识别 <![endif]-->
(3)ID和Class
All HTML elements can be assigned both classes and ids; these are merely labels, and are useful for styling with CSS 。
The main difference between classes and ids is that classes can be used multiple times on a page, but ids can be used only once.
<div class="container">
<%= yield %>
</div>
the yield method inserts the contents of each page into the site layout
<%= link_to image_tag("rails.png", alt: "Rails"), 'http://rubyonrails.org/' %>
ruby中用来图片链接的方法,其中alt为没有图片时显示的内容,we used the image_tag
helper, Rails finds it automatically using the asset pipeline。所以就算在app/assets/images下的图片也可以找到。
<%= render 'layouts/header' %>
自动去调用app/views/layouts/_header.html.erb而已。
assets在哪,是什么?
app/assets: assets specific to the present application
lib/assets: assets for libraries written by your dev team
vendor/assets: assets from third-party vendors
he three most common cases are .scss for Sass, .coffee for CoffeeScript, and .erb for embedded Ruby (ERb). scss是css的一个超集,是他的一种补充,并不是一种新的语法。它里面可以用nesting嵌套和variable变量。
$grayMediumLight就是一个变量,在之前可以定义 $grayMediumLight: #eaeaea;
footer {
margin-top: 45px;
padding-top: 5px;
border-top: 1px solid $grayMediumLight;
color: $grayLight;
a {
color: $gray;
&:hover {
color: $grayDarker;
}
}
small {
float: left;
}
ul {
float: right;
list-style: none;
li {
float: left;
margin-left: 10px;
}
}
}
<%= link_to "About", about_path %> 可以调用的原因,route处有了以下代码
match'/about',to:'static_pages#about' 自动创建了以下两个东西
about_path => '/about'about_url => 'http://localhost:3000/about'