Philipp Tuchardt / SCSS - padding and margin nesting

Created Mon, 03 Feb 2025 00:00:00 +0000
70 Words

Optimized SCSS Nesting for Clean and Efficient Code

Learn how to use SCSS nesting to write cleaner and more structured styles. The default approach keeps properties organized, while nesting helps maintain clarity by grouping related styles. Improve readability and maintainability with this simple SCSS technique! 🚀

Default

.class {
    background-color: black;
    padding: 0.625rem 0 1.875rem 0;
}

Nested

.class {
    background-color: black;

    padding: {
        top: 1.25rem;
        bottom: 1.875rem;
    }
}