npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

bootstrap-ratio-utilities

v1.0.3

Published

Bootstrap Ratio Utilities: Having a Responsive Ratio Utility, which needed for switching ratios for media brackpoints.

Downloads

865

Readme

Bootstrap Ratio Utilities

Bootstrap ~5.3.0 Documentation on Ratios

Having Two Bootstrap Ratio Utilities

Responsive ratio utility

Ratio Utility with responsive options, which needed for switching ratios for media breakpoints.

  • Adds (-sm, -md, -lg, -xl, -xxl) to ratio classes to change the ratio for that brackpoint
  • Use the normal ration classes for mobiles which less than -sm

Flip Ratio Utility

Flip Ratio Utility, which needed for flipping ratios for media breakpoints.

  • Adds (-flip-xs, -flip-sm, -flip-md, -flip-lg, -flip-xl, -flip-xxl) to ratio classes to change the ratio for that brackpoint
  • Use the -flip-xs ratio classes for mobiles which less than -flip-sm or -sm in case of using both ratio utilities at the same time
npm i bootstrap-ratio-utilities

or

yarn add bootstrap-ratio-utilities

Import the library in a custom bootstrap 4/5 theme base file bootstrap.base.scss or custom_theme.base.scss

// Custom theme base, with Bootstrap overrides.
// -----------------------------------------------------------------------------
@import "../node_modules/bootstrap/scss/functions";      // Bootstrap functions.
@import "../node_modules/bootstrap/scss/variables";      // Bootstrap variables.
@import "../node_modules/bootstrap/scss/variables-dark"; // Bootstrap variables dark.
@import "../node_modules/bootstrap/scss/maps";           // Bootstrap maps.
@import "../node_modules/bootstrap/scss/mixins";         // Bootstrap mixins.
@import "../node_modules/bootstrap/scss/utilities";      // Bootstrap utilities.
// -----------------------------------------------------------------------------

// Responsive ratio utility.
@import "../node_modules/bootstrap-ratio-utilities/utilities/scss/responsive-ratio.scss";

In case the Flip Ratio Utility was needed

// Flip ratio utility.
@import "../node_modules/bootstrap-ratio-utilities/utilities/scss/flip-ratio.scss";

Examples for Responsive ratio utility:

Example #1 responsive iframe ratio utility

<div class="ratio ratio-4x3 ratio-16x9-sm">
   <iframe src="https://youtube.com/embed/bTqVqk7FSmY?autoplay=1&mute=1" frameborder="0" allowtransparency="" width="1600" height="900" loading="lazy"></iframe>
</div>

Example #2: responsive Remote Video ratio with normal 4:3 ratio ratio-4x3 on mobiles, and ratio of 16:9 on tablets, medium, and large screens, But 21:9 on extra extra large screen sizes

<div class="varbase-video-player ratio ratio-4x3 ratio-16x9-sm ratio-21x9-xxl">
   <iframe src="https://youtube.com/embed/bTqVqk7FSmY?autoplay=1&mute=1" frameborder="0" allowtransparency="" width="1600" height="900" loading="lazy"></iframe>
</div>

Example #3: Responsive image ratio with normal 4:3 ratio ratio-4x3 on mobiles, and ratio of 16:9 on tables and larger screen sizes.

<div class="field field--name-field-media-image field--type-image ratio ratio-4x3 ratio-16x9-sm">
  <img src="https://raw.githubusercontent.com/Vardot/varbase_media_demo/10.0.0/content/file/coworking-1.jpg">
</div>

It can be integrated with Dynamic Responsive Image (or drimage)

Examples for Flip Ratio Utility:

Example #4: Flipped image ratio to 9:16 on mobiles and tables, but 16:9 on medium screen sizes and larger

<div class="ratio ratio-16x9-flip-xs ratio-16x9-flip-sm ratio-16x9-md">
  <img src="https://raw.githubusercontent.com/Vardot/varbase_media_demo/10.0.0/content/file/coworking-1.jpg">
</div>

It can be integrated with Dynamic Responsive Image (or drimage) with height integration and img-fluid