Giter Club home page Giter Club logo

sass-responsive-demo's Introduction

SASS-Responsive-Demo

Description

This is a basic responsive frontend highlighting some of the key aspects of the CSS preprocessor SASS.

Based on the tutorial by DesignCourse

In ./css/main.scss you will find the main code for the project.

Key Points

  1. Variables

    //Creation
    $padding: 15px;
    $borders: 15px;
    
    //Use
    padding: $padding;
  2. Grouped Variables (objects)

    $colors: (
      primary: #005dff,
      primary-light: lighten(#005dff, 40%),
      primary-dark: darken(#005dff, 40%),
      accent: #fff6bb
    );
  3. Functions
    Create Function

    //function below is cleaning up object variable call
    
    @function color($color-name) {
      // way to call key:value pairs from sass objects
      @return map-get($colors, $color-name);
    }


    Use Function

    background-color: color(primary);
  4. Mixins
    Creat Mixin

    //below is used to make basic @media query formate
    
    @mixin desktop {
      @media (min-width: #{$desktop}) {
        @content;
      }
    }


    Use Mixin

    @include desktop {
      display: grid;
      grid-template-columns: 50% auto;
      grid-template-areas: "primary card";
    }
  5. Nested Structure
    It is possible to use nested structures in SASS to mimic the HTML structure. This helps with organization.

    ul {
      list-style-type: none;
      margin: 0;
      padding: 0;
    
      li {
        margin-bottom: 10px;
    
        span {
          position: absolute;
          width: 30px;
          height: 30px;
          background-color: color(primary-light);
          border-radius: 50%;
          margin-right: 10px;
        }
    
        strong {
          display: inline-block;
          margin-left: max(40px);
          margin-top: 10px;
        }
      }
    }
  6. Math
    You can do math in SASS.

    //Use Case
    
    padding: $padding * 4;

sass-responsive-demo's People

Contributors

trtincher avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.