Sass features related to Web Components

Source: Internet
Author: User

Sass

Https://en.wikipedia.org/wiki/Sass_ (Stylesheet_language)

Sass (syntactically awesome stylesheets) is a style sheet language initially designed by H Ampton Catlin and developed by Natalie Weizenbaum. [2][3] after its initial versions, Weizenbaum and Chris Eppstein continu

Website

Http://sass-lang.com

Sass is the most mature, stable, and powerful professional grade CSS extension language in the world.

Know:

In fact, sass rules a set of CSS syntax, this syntax is not performed on the browser, but for the convenience of writing CSS files, and maintenance convenience, by the Sass tool in the compilation environment, the sass file into a CSS file, this file can be run on the browser.

Http://sass-lang.com/guide

Git

Https://github.com/sass/sass

Installation:

Http://sass-lang.com/install

Http://www.ruanyifeng.com/blog/2012/06/sass.html

Function

Http://sass-lang.com/guide

Variables
$font-stack:    Helvetica, sans-serif;$primary-color: #333;body { font: 100% $font-stack; color: $primary-color;}
Nesting

But too deep nesting, also is not conducive to maintenance, not recommended to use.

Nav{Ul{margin: 0padding: 0list-style: none} li {display:  Inline-block} a {display:  Blockpadding: 6px 12pxtext-decoration: none}}             /span>                 
Partials

The underscore lets Sass know that the file was only a partial file and then it should not being generated into a CSS file. Sass partials is used with the @import directive.

_partial.scss

Import
// _reset.scsshtml,body,ul,ol { margin: 0; padding: 0;}

// base.scss@import ‘reset‘;body { font: 100% Helvetica, sans-serif; background-color: #efefef;}
Mixins
   @mixin border-radius  ( $radius ) {- Webkit-border-radius:  $radius -moz-border-radius:  $radius -ms-border-radius:  $radius border-radius:  $radius ;} .box { @include border-radius ( Span class= "M" >10px);                /span>                
Extend/inheritance
.message {  border: 1px solid #ccc; padding: 10px; color: #333;}.success { @extend .message; border-color: green;}

Operators
.container { width: 100%; }article[role="main"] { float: left; width: 600px / 960px * 100%;}
Component-dependent

Components involve the following functions:

1, partials, ensure that each component of the CSS file can be managed alone.

2, extends/inheritance, inheritance can guarantee the same component, inherit the same father style.

3, mixins, you can let the same function of a set of code, in a functional way, defined together.

4, Imports, to ensure that the container control, you can combine the container of the child control style.

Sass features related to Web Components

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.