Giter VIP home page Giter VIP logo

hidden.less's Introduction

hidden.less — responsive visibility classnames

npm version bower version FOSSA Status

Responsive classnames generator for hidding some HTML depending on media breakpoints.

Installation

Compiled from CDN
https://unpkg.com/[email protected]/hidden.css
https://unpkg.com/[email protected]/hidden.min.css
https://unpkg.com/[email protected]/hidden.min.css.map

NPM
npm install hidden.less --save-dev

Bower
bower install hidden.less --save

How it works

.hidden-from-*

Hides content from selected breakpoint and on larger screens. Example as rendered in CSS:

@media (min-width: 576px) {
  .hidden-from-sm {
    display: none;
  }
}
xs sm md lg xl
0—575px 576—767px 768—991px 992—1199px 1200—∞px
.hidden hidden hidden hidden hidden hidden
.hidden-from-xs hidden hidden hidden hidden hidden
.hidden-from-sm hidden hidden hidden hidden
.hidden-from-md hidden hidden hidden
.hidden-from-lg hidden hidden
.hidden-from-xl hidden

.hidden-upto-*

Hides content from smaller screens and up to selected breakpoint. Example as rendered in CSS:

@media (max-width: 767px) {
  .hidden-upto-md {
    display: none;
  }
}
xs sm md lg xl
0—575px 576—767px 768—991px 992—1199px 1200—∞px
.hidden-upto-sm hidden
.hidden-upto-md hidden hidden
.hidden-upto-lg hidden hidden hidden
.hidden-upto-xl hidden hidden hidden hidden

.hidden-between-*-*

Hides content from one breakpoint to another.

@media (min-width: 576px) and (max-width: 767px) {
  .hidden-between-sm-md {
    display: none;
  }
}
xs sm md lg xl
0—575px 576—767px 768—991px 992—1199px 1200—∞px
.hidden-between-xs-sm hidden
.hidden-between-sm-md hidden
.hidden-between-md-lg hidden
.hidden-between-lg-xl hidden

.hidden-print

For hidding something on print. Doesn't have any breakpoints.

@media print {
  .hidden-print {
    display: none;
  }
}

Usage in HTML

Link compiled hidden.css and apply classes to any HTML element to make them display:none.

Usage in LESS

Install library with npm install hidden.less --save-dev and include its main file inside your project less file:

@import (less) "./node_modules/hidden.less/hidden.less";

That is enough to run library with default parameters.

Default parameters

Parameters stored in mixin:

.hidden-settings() {
    // media breakpoints
    @breakpoints:
        576px,
        768px,
        992px,
        1200px;

    // names for breakpoint suffixes
    @suffixes: xs, sm, md, lg, xl;

    // IMPORTANT: suffixes count should be bigger than breakpoints count by 1
    // suffixes-count = breakpoints-count + 1
}

Redefining parameters

To change any (or every) parameter add setting mixin after import inside your .less file:

@import (less) "./node_modules/hidden.less/hidden.less";

.hidden-settings() {
    // media breakpoints
    @breakpoints:
        768px,
        1024px,
        1440px;

    // names for breakpoint suffixes
    @suffixes: small, medium, large, huge;

    // IMPORTANT: suffixes count should be bigger than breakpoints count by 1
    // suffixes-count = breakpoints-count + 1
}

In that example was redefined breakpoints and suffix names.

License

FOSSA Status

hidden.less's People

Contributors

dependabot[bot] avatar fossabot avatar paulradzkov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

fossabot

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.