📅  最后修改于: 2023-12-03 14:40:17.748000             🧑  作者: Mango
CSS (Cascading Style Sheets) is a style sheet language used for describing the presentation of a document written in HTML or XML. CSS describes how HTML elements should be displayed on screen, paper, or other media.
/* Selects all paragraphs */
p {
font-family: Arial, sans-serif;
font-size: 16px;
line-height: 1.5;
color: #333;
}
/* Selects all links */
a {
color: #007bff;
text-decoration: none;
}
/* Adds a hover effect to links */
a:hover {
text-decoration: underline;
}
SCSS (Sass CSS) is a preprocessor scripting language that is interpreted or compiled into CSS. SCSS extends CSS syntax with features like variables, nested rules, mixins, and functions.
// Variables
$primary-color: #007bff;
$secondary-color: #6c757d;
// Mixins
@mixin cover {
background-size: cover;
background-position: center center;
}
// Nesting
nav {
ul {
margin: 0;
padding: 0;
list-style: none;
}
li {
display: inline-block;
a {
display: block;
padding: 10px;
}
}
}
// Functions
@function half($number) {
@return $number / 2;
}
// Operators
.container {
width: 100% - 40px;
margin: auto;
padding: 20px;
}
CSS is a widely-used style sheet language, while SCSS is a preprocessor scripting language that is interpreted or compiled into CSS. CSS is easy to learn and requires no compilers, but SCSS allows for modularized and reusable code, making maintenance and updates easier. Choose the one that fits your needs best.