Git Product home page Git Product logo

sassresponsivefontsize's Introduction

Sass Responsive Font Size

Responsive Font Size Sass plugin using screen widths and automatic media querie generation

Install

Install Sass, required for this plugin

Import the scss file into your main scss and add location of the file example: libs or partials

@import "LOCATION/responsive-font-size";

Usage Example

In where you define your global variables

$xsmall-screen: 320px; // Mobile
$small-screen: 768px; // Tablet
$medium-screen: 940px; // Tablet Landscape
$large-screen: 1280px; // Small Desktop
$xlarge-screen: 1440px; // Large Desktop

In any class use:

The font in the example goes from 12px on mobile devices to 15 right before it hits tablet, then on tablet uses 12 and goes up to 20 for desktop at a rate of 0.8em( every 0.8 ems its adjusts )

@include responsive-font-size (
  $min-font-size: em-calc(12), // Font size at smallest width
  $minbreak-font-size: em-calc(15), // Font size at medium break
  $maxbreak-font-size: em-calc(12), // Font size at other end of medium break
  $max-font-size: em-calc(20), // Font size at largest width
  $min-screen-width: $xsmall-screen, // Variable/value of small width
  $break-screen-width: $small-screen, // Variable/value of medium (breakpoint) width
  $max-screen-width: $xlarge-screen, // Variable/value of largest width 
  $font-size-step: 0.8em // Points of changes, the smaller = more css/more changes/smoother scaling of size
);

Browser Support


Works with browsers that support media queries. Basically everything except ie6,7,8. You can use respond.js to make media queries work in ie8.


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.