• 欢迎访问速搜资源吧,如果在网站上找不到你需要的资源,可以在留言板上留言,管理员会尽量满足你!

【速搜问答】SASs是什么

问答 admin 3年前 (2020-07-27) 564次浏览 已收录 0个评论

汉英对照:
Chinese-English Translation:

Sass 是一个将脚本解析成CSS的脚本语言,即 SassScript。Sass 扩展了 CSS3,增加了规则、变量、混入、选择器、继承等特性,因不是标准的CSS格式,语法内部可以使用动态变量等,所以更像一种极简单的动态语言。

Sass is a scripting language that parses scripts into CSS, namely sassscript. Sass extends CSS3, adding rules, variables, mixing, selector, inheritance and other features. Because it is not a standard CSS format, dynamic variables can be used inside the syntax, so it is more like a very simple dynamic language.

Sass(英文全称:Syntactically Awesome Stylesheets)是一个最初由 Hampton Catlin 设计并由 Natalie Weizenbaum 开发的层叠样式表语言。在开发最初版本之后,Weizenbaum 和 Chris Eppstein 继续通过 SassScript 来继续扩充 Sass 的功能。SassScript 是一个在 Sass 文件中使用的小型脚本语言。

Sass is a cascading style sheet language originally designed by Hampton Catlin and developed by Natalie Weizenbaum. After the initial version was developed, Weizenbaum and Chris eppstein continued to extend sass functionality through sassscript. Sassscript is a small scripting language used in sass files.

Sass 是一款强化 CSS 的辅助工具,它在 CSS 语法的基础上增加了变量 (variables)、嵌套 (nested rules)、混合 (mixins)、导入 (inline imports) 等高级功能,这些拓展令 CSS 更加强大与优雅。使用 Sass 以及 Sass 的样式库(如 Compass)有助于更好地组织管理样式文件,以及更高效地开发项目。

Sass is an auxiliary tool for strengthening CSS. It adds variables, nested rules, mixins, and inline imports to CSS syntax. These extensions make CSS more powerful and elegant. Using sass and sass style libraries (such as compass) helps to better organize and manage style files and develop projects more efficiently.

1. 特色功能 (Features)

1. Features

完全兼容 CSS3

Fully compatible with CSS3

在 CSS 基础上增加变量、嵌套 (nesting)、混合 (mixins) 等功能

Add variables, nesting, mixins and other functions on the basis of CSS

通过函数进行颜色值与属性值的运算

Operation of color value and attribute value through function

提供控制指令 (control directives)等高级功能

Provide advanced functions such as control directives

自定义输出格式

Custom output format

2. 语法格式 (Syntax)

2. Syntax

Sass 有两种语法格式。首先是 SCSS (Sassy CSS) —— 也是本文示例所使用的格式 —— 这种格式仅在 CSS3 语法的基础上进行拓展,所有 CSS3 语法在 SCSS 中都是通用的,同时加入 Sass 的特色功能。此外,SCSS 也支持大多数 CSS hacks 写法以及浏览器前缀写法 (vendor-specific syntax),以及早期的 IE 滤镜写法。这种格式以 .scss 作为拓展名。

Sass has two syntax formats. The first is SCSS (sassy CSS) – also the format used in this example – this format is only expanded on the basis of CSS3 syntax. All CSS3 syntax is universal in SCSS, and the features of SASS are added. In addition, SCSS also supports most CSS hacks and vendor specific syntax, as well as early ie filter writing. This format takes. SCSS as the extension name.

另一种也是最早的 Sass 语法格式,被称为缩进格式 (Indented Sass) 通常简称 “Sass”,是一种简化格式。它使用 “缩进” 代替 “花括号” 表示属性属于某个选择器,用 “换行” 代替 “分号” 分隔属性,很多人认为这样做比 SCSS 更容易阅读,书写也更快速。缩进格式也可以使用 Sass 的全部功能,只是与 SCSS 相比个别地方采取了不同的表达方式,具体请查看 the indented syntax reference。这种格式以 .sass 作为拓展名。

The other is also the earliest sass syntax format, which is called indented sass. It is usually referred to as “sass” for short, and is a simplified format. It uses “indent” instead of “curly brackets” to indicate that the attribute belongs to a selector, and uses “line feed” instead of “semicolon” to separate attributes. Many people think that this is easier to read and faster to write than SCSS. Indentation format can also use all the functions of SASS, but compared with SCSS, some places adopt different expressions. For details, please refer to the indented syntax reference. This format takes. Sass as the extension name.

Sass 是一个将脚本解析成 CSS 的脚本语言,即 SassScript。Sass 包括两套语法。最开始的语法叫做“缩进语法”,与 Haml 类似,使用缩进来区分代码块,并且用回车将不同规则分隔开。而较新的语法叫做“SCSS”,使用和 CSS 一样的块语法,即使用大括号将不同的规则分开,使用分号将具体的样式分开。通常情况下,这两套语法通过.sass 和.scss 两个文件扩展名区分开。

Sass is a scripting language that parses scripts into CSS, namely sassscript. Sass includes two sets of grammars. The first syntax was called “indentation syntax,” which, like HAML, used indentation to distinguish code blocks and carriage returns to separate different rules. The newer syntax, called “SCSS,” uses the same block syntax as CSS, which uses braces to separate rules and semicolons to separate specific styles. Usually, the two sets of syntax are distinguished by the. Sass and. SCSS file extensions.

Sass 扩展了 CSS3,增加了规则、变量、混入、选择器、继承等等特性。Sass 生成良好格式化的 CSS 代码,易于组织和维护。

Sass extends CSS3 by adding rules, variables, mixing, selectors, inheritance, and so on. Sass generates well formatted CSS code, which is easy to organize and maintain.

SASS 是对 CSS3(层叠样式表)的语法的一种扩充,它可以使用巢状、混入、选择子继承等功能,可以更有效有弹性的写出 Stylesheet。Sass 最后还是会编译出合法的 CSS 让浏览可以使用,也就是说它本身的语法并不太容易让浏览器识别(虽然它和 CSS 的语法非常的像,几乎一样),因为它不是标准的 CSS 格式,在它的语法内部可以使用动态变量等,所以它更像一种极简单的动态语言。

Sass is an extension of the syntax of CSS3 (cascading style sheets). It can use nested, mixed in, select child inheritance and other functions to write stylesheets more effectively and flexibly. Sass will eventually compile legal CSS for browsing. That is to say, its syntax is not easy to be recognized by the browser (although its syntax is very similar to CSS, almost the same), because it is not a standard CSS format, dynamic variables can be used inside its syntax, so it is more like a very simple dynamic language.


速搜资源网 , 版权所有丨如未注明 , 均为原创丨转载请注明原文链接:【速搜问答】SASs是什么
喜欢 (0)
[361009623@qq.com]
分享 (0)
发表我的评论
取消评论
表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址