how to use sass in html code example

Example 1: how to use scss in html

/* Answer to: "how to use scss in html" */

/*
  Unfortunately, you can't directly insert an SCSS (Sassy CSS) file
  into your HTML. That's because SASS is a superset (or so-called
  preprocessor or extension) of CSS3's syntax, which is NOT
  supported by web browsers.

  To take full advantage of all the incredible features offered by
  SCSS in your HTML page, you’ll first have to compile it down
  to CSS.

  For more information, check out the answers in:
  https://www.quora.com/How-do-I-insert-an-SCSS-file-into-HTML
*/

Example 2: css sass scss

/*SMART DIFFERENCE*/
/*CSS*/
body {
  font: 100% Helvetica, sans-serif;
  color: #333;
}

/*SCSS*/

$font-stack:    Helvetica, sans-serif;
$primary-color: #333;

body {
  font: 100% $font-stack;
  color: $primary-color;
}


/*SASS*/
$font-stack:    Helvetica, sans-serif
$primary-color: #333

body
  font: 100% $font-stack
  color: $primary-color

Example 3: Sass Tutorial

/* Define standard variables and values for website */
$bgcolor: lightblue;
$textcolor: darkblue;
$fontsize: 18px;

/* Use the variables */
body {
  background-color: $bgcolor;
  color: $textcolor;
  font-size: $fontsize;
}

Example 4: scss

sass --watch input.scss output.css

Tags:

Html Example