Zum Hauptinhalt springen
tsecurity.de LIVE
Echtzeit-Radar & Feeds
Alle RSS Feeds
👥 Community & Social
YouTube Security VideosVisual Studio Code: Agent Merge: Keep Your PR Moving in VS Code(22.09.2026 um 17:00 Uhr)
YouTube Security VideosOne-Shot AI Builds Go Local with Qwen 3.8 on AMD Ryzen AI Max+(22.09.2026 um 16:39 Uhr)
YouTube Security Videosheise & c't: So erkennt KI Ertrinkende im Schwimmbad(22.09.2026 um 15:00 Uhr)
YouTube Security VideosHow to automate repetitive developer tasks with GitHub Copilot app(22.09.2026 um 17:00 Uhr)
YouTube Security VideosGoogle Ads: Convert high-value leads in 90 seconds | Rethink ROI 2026(22.09.2026 um 15:45 Uhr)
YouTube Security VideosPC-WELT: Der Blutdruck eines Gamers!(22.09.2026 um 17:54 Uhr)
YouTube Security VideosVisual Studio Code: Agent Merge: Keep Your PR Moving in VS Code(22.09.2026 um 17:00 Uhr)
YouTube Security VideosOne-Shot AI Builds Go Local with Qwen 3.8 on AMD Ryzen AI Max+(22.09.2026 um 16:39 Uhr)
YouTube Security Videosheise & c't: So erkennt KI Ertrinkende im Schwimmbad(22.09.2026 um 15:00 Uhr)
YouTube Security VideosHow to automate repetitive developer tasks with GitHub Copilot app(22.09.2026 um 17:00 Uhr)
YouTube Security VideosGoogle Ads: Convert high-value leads in 90 seconds | Rethink ROI 2026(22.09.2026 um 15:45 Uhr)
YouTube Security VideosPC-WELT: Der Blutdruck eines Gamers!(22.09.2026 um 17:54 Uhr)
Intelligence View
⚡ tsecurity.de Intelligence

50 Most Useful SASS Snippets

Variables & Basic Syntax 1. Defining Variables $primary-color: #3498db; $padding-base: 16px; 2. Using Variables .button { background-color: $primary-color; padding: $padding-base; } …

0
↗ Quelle (dev.to)
Reagiere als Erste:r — dein Feedback zählt!




Variables & Basic Syntax






1. Defining Variables






$primary-color: #3498db;
$padding-base: 16px;









2. Using Variables






.button {
background-color: $primary-color;
padding: $padding-base;
}









3. Nesting Selectors






nav {
ul {
margin: 0;
li {
display: inline-block;
}
}
}









4. Parent Selector Reference






.button {
&:hover {
background-color: darken($primary-color, 10%);
}
}









5. Importing Partial Files






@import 'variables';
@import 'mixins';












Mixins






6. Basic Mixin






@mixin flex-center {
display: flex;
justify-content: center;
align-items: center;
}









7. Using Mixin with Parameters






@mixin box-shadow($x, $y, $blur, $color) {
box-shadow: $x $y $blur $color;
}

.card {
@include box-shadow(0, 4px, 5px, rgba(0, 0, 0, 0.3));
}









8. Mixin with Default Parameters






@mixin transition($property: all, $duration: 0.3s) {
transition: $property $duration ease;
}









9. Responsive Mixin






@mixin respond-to($media) {
@if $media == phone {
@media (max-width: 600px) { @content; }
}
}









10. Using Responsive Mixin






.container {
width: 100%;
@include respond-to(phone) {
width: 90%;
}
}












Functions






11. Custom Function






@function double($number) {
@return $number * 2;
}

.box {
width: double(10px);
}









12. Using Color Functions






.button {
background-color: lighten($primary-color, 20%);
}












Control Directives






13. If Statement






@mixin theme-colors($theme) {
@if $theme == dark {
background: black;
color: white;
} @else {
background: white;
color: black;
}
}









14. For Loop






@for $i from 1 through 5 {
.col-#{$i} {
width: 20% * $i;
}
}









15. Each Loop






@each $color in (red, green, blue) {
.bg-#{$color} {
background-color: $color;
}
}









16. While Loop






$i: 6;
@while $i > 0 {
.item-#{$i} {
width: 10px * $i;
}
$i: $i - 1;
}












Placeholders & Extends






17. Defining a Placeholder






%flex-center {
display: flex;
justify-content: center;
align-items: center;
}









18. Extending a Placeholder






nav {
@extend %flex-center;
}












Advanced Nesting






19. Nesting with Parent Selector






.btn {
&--primary {
background-color: $primary-color;
}
}









20. Nested Media Query






.card {
width: 300px;
@media (max-width: 600px) {
width: 100%;
}
}












Maps & Lists






21. Defining a Map






$themes: (
light: #fff,
dark: #000
);









22. Accessing Map Value






body {
background: map-get($themes, dark);
}









23. Looping Over Map






@each $name, $color in $themes {
.bg-#{$name} {
background-color: $color;
}
}












Responsive Design






24. Mobile First Media Query






@mixin mobile {
@media (max-width: 600px) {
@content;
}
}

.container {
width: 100%;
@include mobile {
padding: 10px;
}
}












Helpers






25. Clearfix Mixin






@mixin clearfix {
&::after {
content: "";
display: table;
clear: both;
}
}









26. Using Clearfix






.container {
@include clearfix;
}












Animations






27. Simple Animation






@keyframes fadeIn {
from { opacity: 0; }
to { opacity: 1; }
}

.fade-in {
animation: fadeIn 1s ease forwards;
}









28. Animation Mixin






@mixin animation($name, $duration) {
animation-name: $name;
animation-duration: $duration;
animation-fill-mode: forwards;
}









29. Using Animation Mixin






.alert {
@include animation(fadeIn, 0.5s);
}












Color Manipulation






30. Darken Color






$dark-primary: darken($primary-color, 10%);









31. Saturate Color






$bright-color: saturate($primary-color, 20%);












Programmers Known Snippets






32. Modular Scale Function






@function ms($step, $base: 1rem, $ratio: 1.2) {
@return $base * pow($ratio, $step);
}









33. Responsive Font Size






h1 {
font-size: ms(3);
}









34. Hex to RGB Function






@function hex-to-rgb($color) {
@return red($color), green($color), blue($color);
}









35. Using !default Flag






$font-stack: Helvetica, sans-serif !default;









36. Conditional Mixin Example






@mixin theme-btn($type) {
@if $type == primary {
background: $primary-color;
} @else {
background: grey;
}
}












Utility Mixins






37. Vertical Centering






@mixin vertical-center {
display: flex;
align-items: center;
}









38. Triangle Shape






.triangle {
width: 0;
height: 0;
border-left: 10px solid transparent;
border-right: 10px solid transparent;
border-bottom: 20px solid $primary-color;
}









39. Text Overflow Ellipsis






@mixin ellipsis {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}









40. Using Text Ellipsis






.title {
@include ellipsis;
}












Grid & Flex Helpers






41. Center Grid Item






.grid-center {
display: grid;
place-items: center;
}









42. Flex Gap Polyfill






@mixin flex-gap($gap) {
margin: -#{$gap/2};
> * {
margin: #{$gap/2};
}
}












Advanced Functions






43. Calculate Rem from px






@function rem($px, $base: 16) {
@return #{$px / $base}rem;
}












Debugging Helpers






44. Outline Debugging






@mixin debug {
outline: 1px solid red;
}









45. Using Debug Mixin






.container {
@include debug;
}












Placeholder Selectors






46. DRY Button Styles






%btn {
padding: 10px 20px;
border-radius: 5px;
cursor: pointer;
}









47. Extend Button Style






.primary-btn {
@extend %btn;
background-color: $primary-color;
color: white;
}












Miscellaneous






48. Check if Variable Exists






@if variable-exists(primary-color) {
color: $primary-color;
} @else {
color: black;
}









49. Charset Declaration






@charset "UTF-8";









50. Media Query with Map






$breakpoints: (
mobile: 600px,
tablet: 900px
);

@mixin respond($device) {
$size: map-get($breakpoints, $device);
@media (max-width: $size) {
@content;
}
}


Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten 50 Most Useful SASS Snippets

Thematisch verwandte Begriffe: Most, Useful, SASS, Snippets · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-94127 | When a BIG-IP APM access policy and an OAuth profile is configured on a …
Advisory →
TTS Reader • tsecurity.de Voice
tsecurity.de Icon
tsecurity.de App
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag
Themen-Radar & Intelligence Matrix
Echtzeit-Taxonomie nach Angriffsvektoren & Plattformen

tsecurity.de Live Threat Radar

🔴 LIVE RADAR
MONITORING
AKTIV
CVE-DATENBANK
LIVE
🔍
Community Radar & Live Chat
Sentinel Bot online • Live-Stream
Dein Cluster: Security Explorer
Match:
lädt…
Verbindung zum Community-Stream wird aufgebaut...
Bearbeitungsmodus — Senden überschreibt deine Nachricht
Community-Puls — was gerade passiert
lädt…
Aktivitäten deiner Analysten
lädt…
Neues Thema oder Eilmeldung einreichen

Reiche interessante Links, Zero-Days oder Debatten ein. Die Community entscheidet per Upvote über die Veröffentlichung.

Heiß diskutierte Einreichungen
🔖 Gespeicherte Artikel
📂 Keine gespeicherten Artikel vorhanden.
Zurück Ziehen Vor
Links: vorheriger Artikel Rechts: nächster Artikel unten: schließen
News NIS-2 Frühwarnung Tier-1 Intel ⏱️ 3 Min vor 10 Min
Artikeldaten werden geladen...

Zurück: vorheriger Vor: nächster
↗ Original-Quelle
Social Reaktionen Deine Reaktion zählt
Einstufung & Relevanz-Poll 0 Stimmen
In sozialen Netzwerken teilen 1-Klick