In addition to Idriss answer:
CSS
In CSS we write code as depicted bellow, in full length.
body{
width: 800px;
color: #ffffff;
}
body content{
width:750px;
background:#ffffff;
}
SCSS
In SCSS we can shorten this code using a @mixin so we don’t have to write color and width properties again and again. We can define this through a function, similarly to PHP or other languages.
$color: #ffffff;
$width: 800px;
@mixin body{
width: $width;
color: $color;
content{
width: $width;
background:$color;
}
}
SASS
In SASS however, the whole structure is visually quicker and cleaner than SCSS.
- It is sensitive to white space when you are using copy and paste,
It seems that it doesn't support inline CSS currently.
$color: #ffffff $width: 800px $stack: Helvetica, sans-serif body width: $width color: $color font: 100% $stack content width: $width background:$color
In addition to Idriss answer:
CSS
In CSS we write code as depicted bellow, in full length.
body{
width: 800px;
color: #ffffff;
}
body content{
width:750px;
background:#ffffff;
}
SCSS
In SCSS we can shorten this code using a @mixin so we don’t have to write color and width properties again and again. We can define this through a function, similarly to PHP or other languages.
$color: #ffffff;
$width: 800px;
@mixin body{
width: $width;
color: $color;
content{
width: $width;
background:$color;
}
}
SASS
In SASS however, the whole structure is visually quicker and cleaner than SCSS.
- It is sensitive to white space when you are using copy and paste,
It seems that it doesn't support inline CSS currently.
$color: #ffffff $width: 800px $stack: Helvetica, sans-serif body width: $width color: $color font: 100% $stack content width: $width background:$color
CSS is the styling language that any browser understands to style webpages.
SCSS is a special type of file for SASS, a program written in Ruby that assembles CSS style sheets for a browser, and for information, SASS adds lots of additional functionality to CSS like variables, nesting and more which can make writing CSS easier and faster.
SCSS files are processed by the server running a web app to output a traditional CSS that your browser can understand.
CSS, SCSS, SASS?
Thank you, will do :)
More on reddit.comThe difference between Sass, Scss, and Css?
css - What's the difference between SCSS and Sass? - Stack Overflow
Is sass/scss worth learning
Videos
I'm coding my 1st website and I was wondering which style sheet to use. What's the difference between these 3? Is any of them more supported than the other ones, even in way older browsers? Thanks!
Edit: Thanks for all the answers everyone, I get it now. I was just wondering which one of these I should use because I thought SASS seemed easier - no brackets and you can just edit an element's style within anothwr element's style (if that makes sense). But I am now aware that I should stick to "vanilla" CSS until I am very comfortable with it. Thank you once again. Great subreddit!
Just to give some examples, because that's often a neat way to explain the difference:
CSS (what the browser understands):
h1.foo {
background: red;
}
h1.foo .bar {
text-shadow: 0 1px red;
}
SASS (compiles to CSS, supports things like nesting and variables):
$color: red
h1.foo
background: $color
.bar
text-shadow: 0 1px $color
SCSS (SASS, but written with a CSS-like syntax):
$color: red;
h1.foo {
background: $color;
.bar {
text-shadow: 0 1px $color;
}
}
The latter two compile to CSS when you run them through a program. You then send the compiled files to the browser, since browsers only understand CSS.
The key to surviving in modern web development, and software development in general, is to keep things as simple as possible and only let them get more complex as needs require them to. This crap moves and changes way too fast to try and determine what to use at any given moment based only on what others seem to be doing, not to mention that their reasons for doing it that way may have no relation to what you're trying to do and so there's never a canonical "right" answer (and anyone saying otherwise has an agenda that you'd do well to stear clear of).
So, in your case, it's easy: use plain old CSS unless and until you need some specific thing that SASS or LESS gives you. Neither are required to be productive in any way, shape or form and in fact they seem to just get in the way if your project isn't of a sufficient complexity to make what they provide valuable of for no other reason than they introduce a new build step (the lesser the better).
You'll find out pretty quickly if you need variables for example. A lot of the times you really don't. But if you hit a wall with CSS and you think "gee, if I had variables then I could solve this easy" then it's time to migrate. That's how you know, simple. as that.
Until that point, KISS (Keep It Simple Stupid, in case you've never heard that).
Sass is a CSS pre-processor with syntax advancements. Style sheets in the advanced syntax are processed by the program, and turned into regular CSS style sheets. However, they do not extend the CSS standard itself.
CSS variables are supported and can be utilized but not as well as pre-processor variables.
For the difference between SCSS and Sass, this text on the Sass documentation page should answer the question:
The SCSS syntax uses the file extension
.scss. With a few small exceptions, it’s a superset of CSS, which means essentially all valid CSS is valid SCSS as well. Because of its similarity to CSS, it’s the easiest syntax to get used to and the most popular.
The indented syntax was Sass’s original syntax, and so it uses the file extension
.sass. Because of this extension, it’s sometimes just called “Sass”. The indented syntax supports all the same features as SCSS, but it uses indentation instead of curly braces and semicolons to describe the format of the document.
However, all this works only with the Sass pre-compiler which in the end creates CSS. It is not an extension to the CSS standard itself.
I'm one of the developers who helped create Sass.
The difference is syntax. Underneath the textual exterior they are identical. This is why sass and scss files can import each other. Actually, Sass has four syntax parsers: scss, sass, CSS, and less. All of these convert a different syntax into an Abstract Syntax Tree which is further processed into CSS output or even onto one of the other formats via the sass-convert tool.
Use the syntax you like the best, both are fully supported and you can change between them later if you change your mind.