Fortgeschritten222025-01-15

SCSS Final Project - Professional Landing Page

Baue eine vollständige Landing Page mit SCSS. Variables, Mixins, Responsive Design und moderne Patterns.

#scss#project#landing-page#responsive

SCSS Final Project - Professional Landing Page

Zeit für ein echtes Projekt! Wir bauen eine professionelle Landing Page mit allem was du gelernt hast.

Projekt-Übersicht

Was wir bauen:

  • ✅ Responsive Landing Page
  • ✅ Hero Section
  • ✅ Features Section
  • ✅ Pricing Cards
  • ✅ Contact Form
  • ✅ Dark Mode Toggle
  • ✅ Animations

Tech Stack:

  • SCSS mit 7-1 Pattern
  • Modern CSS (Grid, Flexbox)
  • Responsive Design
  • BEM Naming

Projekt-Setup

mkdir scss-landing-page
cd scss-landing-page

# Struktur erstellen
mkdir -p scss/{abstracts,base,components,layout,pages}
mkdir css

File Structure:

scss-landing-page/
├── scss/
│   ├── abstracts/
│   │   ├── _variables.scss
│   │   ├── _mixins.scss
│   │   └── _functions.scss
│   ├── base/
│   │   ├── _reset.scss
│   │   └── _typography.scss
│   ├── components/
│   │   ├── _buttons.scss
│   │   ├── _cards.scss
│   │   └── _forms.scss
│   ├── layout/
│   │   ├── _header.scss
│   │   ├── _footer.scss
│   │   └── _grid.scss
│   ├── pages/
│   │   └── _home.scss
│   └── main.scss
├── css/
└── index.html

1. Variables

// abstracts/_variables.scss

// ========================================
// Colors
// ========================================

// Brand Colors
$primary: #6366f1;
$secondary: #8b5cf6;
$accent: #ec4899;

// Neutrals
$white: #ffffff;
$black: #000000;
$gray-50: #f9fafb;
$gray-100: #f3f4f6;
$gray-200: #e5e7eb;
$gray-300: #d1d5db;
$gray-400: #9ca3af;
$gray-500: #6b7280;
$gray-600: #4b5563;
$gray-700: #374151;
$gray-800: #1f2937;
$gray-900: #111827;

// Semantic Colors
$success: #10b981;
$warning: #f59e0b;
$error: #ef4444;
$info: #3b82f6;

// ========================================
// Typography
// ========================================

$font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
$font-serif: Georgia, serif;
$font-mono: "Courier New", monospace;

$font-size-xs: 0.75rem;   // 12px
$font-size-sm: 0.875rem;  // 14px
$font-size-base: 1rem;    // 16px
$font-size-lg: 1.125rem;  // 18px
$font-size-xl: 1.25rem;   // 20px
$font-size-2xl: 1.5rem;   // 24px
$font-size-3xl: 1.875rem; // 30px
$font-size-4xl: 2.25rem;  // 36px
$font-size-5xl: 3rem;     // 48px

$font-weight-light: 300;
$font-weight-normal: 400;
$font-weight-medium: 500;
$font-weight-semibold: 600;
$font-weight-bold: 700;

// ========================================
// Spacing
// ========================================

$spacing-xs: 0.25rem;   // 4px
$spacing-sm: 0.5rem;    // 8px
$spacing-md: 1rem;      // 16px
$spacing-lg: 1.5rem;    // 24px
$spacing-xl: 2rem;      // 32px
$spacing-2xl: 3rem;     // 48px
$spacing-3xl: 4rem;     // 64px
$spacing-4xl: 6rem;     // 96px

// ========================================
// Layout
// ========================================

$container-max-width: 1200px;
$section-padding: $spacing-4xl;

// ========================================
// Breakpoints
// ========================================

$breakpoints: (
  "xs": 0,
  "sm": 576px,
  "md": 768px,
  "lg": 992px,
  "xl": 1200px,
  "xxl": 1400px
);

// ========================================
// Others
// ========================================

$border-radius-sm: 0.25rem;
$border-radius: 0.5rem;
$border-radius-lg: 1rem;
$border-radius-full: 9999px;

$shadow-sm: 0 1px 2px 0 rgba($black, 0.05);
$shadow: 0 4px 6px -1px rgba($black, 0.1);
$shadow-lg: 0 10px 15px -3px rgba($black, 0.1);
$shadow-xl: 0 20px 25px -5px rgba($black, 0.1);

$transition-fast: 150ms ease;
$transition-base: 300ms ease;
$transition-slow: 500ms ease;

2. Mixins

// abstracts/_mixins.scss
@use "sass:map";
@use "variables" as *;

// ========================================
// Responsive Mixins
// ========================================

@mixin respond-to($breakpoint) {
  @if map.has-key($breakpoints, $breakpoint) {
    $width: map.get($breakpoints, $breakpoint);
    @media (min-width: $width) {
      @content;
    }
  }
}

// ========================================
// Layout Mixins
// ========================================

@mixin container {
  max-width: $container-max-width;
  margin: 0 auto;
  padding: 0 $spacing-md;

  @include respond-to("lg") {
    padding: 0 $spacing-xl;
  }
}

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

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

@mixin grid($cols: 12, $gap: $spacing-md) {
  display: grid;
  grid-template-columns: repeat($cols, 1fr);
  gap: $gap;
}

// ========================================
// Button Mixins
// ========================================

@mixin button-base {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: $spacing-sm $spacing-lg;
  border: 2px solid transparent;
  border-radius: $border-radius;
  font-size: $font-size-base;
  font-weight: $font-weight-semibold;
  cursor: pointer;
  transition: all $transition-base;

  &:disabled {
    opacity: 0.5;
    cursor: not-allowed;
  }
}

@mixin button-variant($bg, $color: $white, $hover-bg: null) {
  @include button-base;
  background: $bg;
  color: $color;

  $hover: if($hover-bg, $hover-bg, darken($bg, 10%));

  &:hover:not(:disabled) {
    background: $hover;
    transform: translateY(-2px);
    box-shadow: $shadow-lg;
  }

  &:active:not(:disabled) {
    transform: translateY(0);
  }
}

// ========================================
// Card Mixins
// ========================================

@mixin card($padding: $spacing-lg) {
  background: $white;
  border-radius: $border-radius-lg;
  padding: $padding;
  box-shadow: $shadow;
  transition: all $transition-base;

  &:hover {
    box-shadow: $shadow-xl;
    transform: translateY(-4px);
  }
}

// ========================================
// Animation Mixins
// ========================================

@mixin fade-in($duration: 1s) {
  animation: fadeIn $duration ease-in;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

3. Components

Buttons

// components/_buttons.scss
@use "../abstracts/variables" as *;
@use "../abstracts/mixins" as *;

.btn {
  @include button-base;

  &--primary {
    @include button-variant($primary);
  }

  &--secondary {
    @include button-variant($secondary);
  }

  &--accent {
    @include button-variant($accent);
  }

  &--outline {
    background: transparent;
    border-color: $primary;
    color: $primary;

    &:hover {
      background: $primary;
      color: $white;
    }
  }

  &--sm {
    padding: $spacing-xs $spacing-md;
    font-size: $font-size-sm;
  }

  &--lg {
    padding: $spacing-md $spacing-xl;
    font-size: $font-size-lg;
  }
}

Cards

// components/_cards.scss
@use "../abstracts/variables" as *;
@use "../abstracts/mixins" as *;

.card {
  @include card;

  &__header {
    margin-bottom: $spacing-md;
  }

  &__title {
    font-size: $font-size-2xl;
    font-weight: $font-weight-bold;
    color: $gray-900;
    margin-bottom: $spacing-sm;
  }

  &__description {
    color: $gray-600;
    line-height: 1.6;
  }

  &__footer {
    margin-top: $spacing-lg;
    padding-top: $spacing-md;
    border-top: 1px solid $gray-200;
  }
}

// Pricing Card
.pricing-card {
  @include card($spacing-xl);
  text-align: center;

  &__price {
    font-size: $font-size-4xl;
    font-weight: $font-weight-bold;
    color: $primary;
    margin: $spacing-lg 0;
  }

  &__features {
    list-style: none;
    padding: 0;
    margin: $spacing-lg 0;

    li {
      padding: $spacing-sm 0;
      border-bottom: 1px solid $gray-100;

      &:last-child {
        border-bottom: none;
      }
    }
  }

  &--featured {
    border: 2px solid $primary;
    transform: scale(1.05);
  }
}

4. Layout

Header

// layout/_header.scss
@use "../abstracts/variables" as *;
@use "../abstracts/mixins" as *;

.header {
  background: $white;
  box-shadow: $shadow-sm;
  position: sticky;
  top: 0;
  z-index: 100;

  &__container {
    @include container;
    @include flex-between;
    padding-top: $spacing-md;
    padding-bottom: $spacing-md;
  }

  &__logo {
    font-size: $font-size-2xl;
    font-weight: $font-weight-bold;
    color: $primary;
    text-decoration: none;
  }

  &__nav {
    display: none;

    @include respond-to("md") {
      display: flex;
      gap: $spacing-lg;
    }
  }

  &__link {
    color: $gray-700;
    text-decoration: none;
    font-weight: $font-weight-medium;
    transition: color $transition-base;

    &:hover {
      color: $primary;
    }

    &--active {
      color: $primary;
    }
  }

  &__mobile-toggle {
    @include respond-to("md") {
      display: none;
    }
  }
}

Hero Section

// pages/_home.scss
@use "../abstracts/variables" as *;
@use "../abstracts/mixins" as *;

.hero {
  @include fade-in;
  padding: $spacing-4xl 0;
  background: linear-gradient(135deg, $primary 0%, $secondary 100%);
  color: $white;
  text-align: center;

  &__container {
    @include container;
  }

  &__title {
    font-size: $font-size-4xl;
    font-weight: $font-weight-bold;
    margin-bottom: $spacing-lg;

    @include respond-to("lg") {
      font-size: $font-size-5xl;
    }
  }

  &__subtitle {
    font-size: $font-size-xl;
    margin-bottom: $spacing-2xl;
    opacity: 0.9;
  }

  &__cta {
    display: flex;
    gap: $spacing-md;
    justify-content: center;
    flex-wrap: wrap;
  }
}

// Features Section
.features {
  padding: $spacing-4xl 0;

  &__container {
    @include container;
  }

  &__grid {
    @include grid(1, $spacing-xl);

    @include respond-to("md") {
      @include grid(2, $spacing-xl);
    }

    @include respond-to("lg") {
      @include grid(3, $spacing-xl);
    }
  }
}

// Pricing Section
.pricing {
  padding: $spacing-4xl 0;
  background: $gray-50;

  &__container {
    @include container;
  }

  &__grid {
    @include grid(1, $spacing-xl);

    @include respond-to("md") {
      @include grid(2, $spacing-xl);
    }

    @include respond-to("lg") {
      @include grid(3, $spacing-xl);
    }
  }
}

5. Main SCSS File

// main.scss

// Abstracts
@use "abstracts/variables";
@use "abstracts/mixins";
@use "abstracts/functions";

// Base
@use "base/reset";
@use "base/typography";

// Layout
@use "layout/header";
@use "layout/footer";
@use "layout/grid";

// Components
@use "components/buttons";
@use "components/cards";
@use "components/forms";

// Pages
@use "pages/home";

Build Command

# Watch Mode
sass --watch scss/main.scss:css/main.css

# Production Build
sass scss/main.scss:css/main.css --style compressed
🎯

Zusammenfassung

Du hast gebaut:

  • ✅ Professional Landing Page
  • ✅ Responsive Design
  • ✅ Component Library
  • ✅ Dark Mode Ready
  • ✅ Performance Optimized

Verwendete SCSS Features:

  • Variables für Consistency
  • Mixins für DRY Code
  • Nesting für Structure
  • @use für Modules
  • Responsive Mixins
  • BEM Naming Pattern
  • 7-1 Architecture

Nächste Schritte:

  • ✨ Dark Mode Implementation
  • ✨ CSS Animations Library
  • ✨ Form Validations Styles
  • ✨ Loading States
  • ✨ Error States
  • ✨ Accessibility Improvements

Herzlichen Glückwunsch! Du hast eine professionelle Landing Page mit SCSS gebaut! 🎉

SCSS/SASSLektion 11 von 13
85% abgeschlossen
Lektion abgeschlossen!

Gut gemacht! 🎉

Du hast "SCSS Final Project - Professional Landing Page" abgeschlossen

Artikel bewerten

0.0 (0 Bewertungen)

Bitte einloggen um zu bewerten