Article Introduction: introduction of less and its difference with sass.
Original:
introduction of less and its difference with sass
Translated from:
An Introduction to less, and Comparison to Sass
Original Author:
Jeremy Hixon
Please respect the copyright, reproduced please indicate the source, thank you!
Since I stumbled upon less one months ago
Objective
Sass is a CSS preprocessor (CSS preprocessor). Its basic idea is to use a special programming language, Web page style design, and then compiled into a normal CSS file.
Sass offers four compile-style options:
Nested: Nested indentation of the CSS code, which is the default value.
Expanded: No indented, extended CSS code.
Compact: A concise form of CSS code.
Compressed: Compressed CS
= ' testborder '> p> input /> P > Div >Assuming that the above 3 DOM elements have such requirements, div to the border, p display border, input only shows the bottom border, and unified with the!important keyword to improve the style of priority;If the handwritten pure CSS would be like this:. Testborder { border:none!important; } . Testborder P { border:1px solid!important;} . Testborder P Input { border-width:0 0 1px 0!important; border-style: solid!important;
">
Main Content
div>
div class="span-4 last">
Right Sidebar
div>
div class="span-24 last">
Footer
div>
div>
body>
html>
Span-x indicates that the content spans X meshes, while the right side has a margin of 10 pixels, such as the span-4 width of 4*40-10=150 pixels. Note that when the content crosses the 24th style, the last style needs to be defined, and the last style is set Right-margin to 0. So the above example is clear, the header and footer acros
One of the main reasons for using the CSS preprocessor language is to use Sass to get a better structure. For example, you want to write cleaner, more efficient, and object-oriented CSS. The interpolation (interpolation) in the Sass is an important part. Let's take a look at the following example:
$properties: (margin, padding);
@mixin Set-value ($side, $value) {
@each $prop in $properties {
#{$
Sass on the official website is this description of Sass:
Sass is a meta language that is higher than CSS, and it can be used to describe file styles clearly and structurally, and has more powerful functions than ordinary CSS.
Sass can provide a more concise and elegant syntax, while providing a variety of features t
Sass has a Chinese problem.
I saw a lot of excellent resources in this garden, and I also wanted to write something. I suddenly thought of a Chinese garbled solution when I was writing sass. I will summarize all of them. (The following test steps are all completed by yourself! No reprinted content. If any error occurs, I hope you can correct it)
Simple Description: it is much easier for
I. What is SASS/SCSS and less?Sass (syntactically Awesome stylesheets) is a dynamic style language, Sass syntax is the indentation syntax, more than CSS more than a number of functions (such as variables, nesting, operation, mixing (Mixin), inheritance, color processing, functions, etc.), easier to read.What is the relationship between
This article mainly introduces the SASS style programming guide for CSS, including the use of nesting tools and comments. For more and more developers, see SASS, we need to pay attention to the number of SASS codes. We can start with the CSS (stacked style sheet) syntax to explain some of the SASS syntax's special poin
As a member of the graph cutting field, or rolling in the front-end field for a period of time, you will slowly find that the current css writing cannot meet your own efficiency. If you have a more powerful framework that makes your css more flexible and easier to reuse and maintain, that would be nice. Obviously, this is nothing new. sass and less are two excellent style preprocessors, which can greatly improve your efficiency. Next we will talk abou
Syntax error: Invalid GBK character error occurs when sass is compiled in ruby,
The ruby environment is used for sass file compilation. Interface-based koala tools and command line modes cannot be used, which is really annoying.
It is easy to see that Chinese comments cannot be compiled or garbled, and the solution after several days is finally solved.
The odd thing about this problem is that there is no pr
What are the preparations for Sass? For new Sass users, if they want to use Sass immediately, they still need to make some preparations. Prepare some things around you to start your Sass journey.
(1) first, familiarize yourself with the basic syntax of sass and understand
Read this article http://www.frostsky.com/2014/07/sass-scss/writing is still relatively clearSass is an extension of CSS3, adding rules nesting , variables , blending , selector inheritance , and more. Convert it to standard, well-formed CSS code by using the command line tool or the Web framework plugin.SCSS is Sass's new syntax, is a shorthand for sassy CSS, is a superset of CSS3 syntax, meaning that all valid CSS3 styles are equally suitable for sa
a file with the following code:GULP.SRC ("Src/**/*.js"). Pipe (Gulp.dest ("dist")); Read all JS under SRC, write to dist directoryEach operation of the gulp returns a Stream object, and all operations are performed in memory without the need to manipulate the disk, which greatly increases the build speed.8.3.2 Preprocessing tasksIn the previous section, the installation, configuration, and definition and execution of the grunt task are described in gulp. This section describes compiling E
I haven't had much contact with Sass before, and then I saw this magical thing seen in the CSS precompiled processor in a front-end knowledge system structure diagram written by Daniel.In fact, although not how to hear it before, but used, you really do not believe, before the NetEase internship in a senior in and I wrote a GitHub pages project, recommended meThe use of MCSs (this is written by the great god NetEase another CSS pre-compiler, of course
I. 1. {} Not required in previous sass, sass file suffix ". Sass"2. {} is required in sass now, the sass file suffix is ". Scss"Role: The role of less and sass are used for code simplification and reuse3. Steps to create a
Sass for the CSS to give the characteristics of dynamic language, such as variables, inheritance, operations, functions, etc., more convenient for the writing and maintenance of CSS!
Sass Installation
Because SASS relies on the ruby environment, make sure Ruby is installed before installing SASS. Install Ruby http://
Use Sass and Compass to write CSS and sasscompass
Recently, I started to use Sass to write CSS Code. At the beginning, although I was not quite used to writing css in chained mode, this is a temporary stage.
If you do not know Sass, you can read previous articles to learn more. Sass mainly has the following features (m
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.