Ruby on Rails Tutorial the fifth chapter perfect layout

Source: Internet
Author: User
Tags ruby on rails

This chapter targets: Detail view, rails routing, Asset Pipeline, Sass
1. Bootstrap is an open source web design framework developed by Twitter
Mockup is a Web concept diagram, often referred to as a "wireframe" in the web, used to show sketches of the final appearance of the application
Servo (P130)

<%= link_to "Help", "#"%>
#link_to的第一个参数是链接文本, the second parameter is the link address, the third parameter is optional, and is a hash.

One of the benefits of Asset pipeline is the ability to automatically optimize resource files for excellent use in production environments.

2, Sass: It is a language to write CSS, from a variety of aspects to enhance the functionality of CSS. The main features are two main functions: nesting and variables. Extension of sass File
Named. Scss, which is an extended set of CSS syntax. All valid CSS files are valid SCSS files. Rails ' Asset pipeline will automatically make
Files with the. scss extension are processed with the SASS preprocessor, so the Custom.css.scss file is processed first through the sass preprocessor and then introduced into the application
Style sheet, and then send it to the browser.

(1) Nesting:

{    text-align: center;} . Center H1 {    margin-bottom: 10px;}

The nested format is as follows:

{    text-align: Center;     h1{        margin-bottom: 10px;    } }
{    float: left;     margin-right: 10px;}  {    color: #fff;     Text-decoration: none;}

The nested format is as follows:

{    float: left;     margin-right: 10px;     &:hover {#在SCSS中, using & conforming to a reference to the parent element        color: #fff;         Text-decoration: none;    } }

(2) Variables:

{    color:#777;}  {    color:#777;}

Here's how to use variables:

{    color: $light-gray;}  {    color: $light-gray;}

3. Links in the layout
Named route: <%= link_to "About", About_path%> if the about_path corresponding URL is modified, the other places to use About_path
The new URL is automatically used.

Ruby on Rails Tutorial the fifth chapter perfect layout

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.