Preface:
Just play Blog Park a few days, found quite good, for me this lazy person is a love toss of people is very good, for work to play computer, play mobile phone users, blog park my blog has a little to my feeling is not very friendly, computer-side looks very beautiful page, mobile unexpectedly is the original mode "Beautiful", because the work is mainly engaged in mobile development, watching the blog can be disabled template style, so decided to blog style refactoring, sharing is a virtue, do not like to spray. This article original blog address: http://www.cnblogs.com/unofficial official website address:www.pushself.com)
preparatory work:
Editing tools: Notepad++,sublime text
Style tool: Sass
turn on automatic compilation of sass files
Method Reference a : Front-end development environment Grunt Automatic Watch compression js file and compile Sass file
Method Reference Two: Install Sass,sass--watch command in Ruby Environment, method One also said, the detailed information can Baidu, Nanyi Teacher's tutorial is quite good amount.
idea One:
The template default CSS, directly here to refactor the CSS style, or upload style file direct reference, this way is more lazy, only local modification is necessary
idea two:
Disable template default CSS, completely re-come, love tossing lazy people I was choosing to upload a CSS style file directly reference
Note : File upload address is file-file upload, the path of the file is http://files.cnblogs.com/username/file name. css
Start work:1. Analysis Template Layout | (brain map from brain map tool)
2. After the new Sass file, we introduce the corresponding MIXIN code block directly, so that we could quickly write the simplified CSS code.
can refer to the desert of the 10 common mixin code blocks, but also in constant updating, because the code block uses @include contains the style, so that does not achieve the simplification of CSS style code, so we can use a small technique, for example, we need a response breakpoint, we can directly use the% Breakpoint, in it contains code blocks, and then @extend inherit%breakpoint, so that your code has become a lot easier, this breakpoint because the text is not an effect, usually we in the page layout of the most inseparable thing is floating , floating this thing is very interesting, heard the Zhang Xinxu teacher told a floating course, he is easy to explain the floating this piece, his voice is too ecstasy, let people long unforgettable.
There is the following HTML code nesting div:
<div id= "Navigator" >
<div id= "Navlist" ></div>
<div class= "Blogstats" ></div>
</div>
The following SASS codes are available:
%clearfix:after{
Content: "";
height:0;
Display:block;
Visibility:hidden;
Clear:both;
}
#navigator {
@extend%clearfix;
}
//CSS3 Multi-prefix auto-generated @mixin CSS3 ($property, $value){@each $prefix in-webkit-,-Moz-,-Ms-,-O, ' {#{$prefix}#{$property}: $value; }}//Responsive breakpoint @mixin Breakpoint ($point){@if $point = = Large {@media (min-width:64.375em) {@content; }} @else if $point = = Medium{@media (Min-width:50em) {@content; }} @else If $point = = Small{@media (Min-width:37.5em) {@content; } } } 3. Width cannot be fixed width
In the main link we can find that maincontent and sidebar have the smallest width, so since the size of the device can not be installed in the container, there will be overflow, added a scroll, mobile devices on the need to drag left and right to display completely, this is very important, Design width by percentage, media Control display, mobile device screen is small when the choice of sidebar placed at the bottom of the article or hidden away, to see a person's preferences.
4. Add META tags
mobile device Add a responsive width viewport tag, content is, width=device-width: Width equals device width; initial-scale=1: Initialize scale size is 1;maximum-scale=1: Maximum scale size is 1;minimum-scale=1: Minimum scale size is 1 ; User-scalable=no: Whether to allow manual size adjustment
<name= "Viewport" content= "width=device-width,initial-scale=1, Maximum-scale=1,minimum-scale=1,user-scalable=no "/>
To update the conclusion:
Because the time relationship has not yet completely updated my style file, the subsequent update file can achieve the corresponding effect, the first serious to write detailed technical articles, I hope you can stay on the homepage and many people to exchange, learn from each other. This article original blog address: http://www.cnblogs.com/unofficial official website address:www.pushself.com)