New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@fylgja/aspect-ratio

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fylgja/aspect-ratio

The aspect ratio component allows you to make not just videos. But anything you want to a certain responsive aspect ratio

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
65
decreased by-38.1%
Maintainers
1
Weekly downloads
 
Created
Source

Fylgja - Aspect Ratio

NPM version license

The aspect ratio component is used to set videos to a certain responsive aspect ratio,

but can also be used for images and other content.

Installation

npm install @fylgja/aspect-ratio

Then include the component in to your code via;

@use "@fylgja/aspect-ratio";
// Or via PostCSS and other options as plain CSS
@import "@fylgja/aspect-ratio/aspect-ratio.css";

How to use

To use the aspect-ratio, create element with the class .aspect-ratio, any child of the aspect-ratio will now always be show in the ratio set by the class.

16/9 is the default ratio.

To edit the ratio use the css variable with the same name.

<div class="aspect-ratio" style="--aspect-ratio: 21/9;">..</div>

Config

As with almost all of our components, CSS variables can be configured to add your own look/style.

Want direct control on the base styles, here are the following SCSS variables can you modify.

$aspect-ratio: "16/9" !default;

PostCSS Calc & CSSNano issue

At the moment PostCSS Calc, which is also part of CSSNano, has an open issue where is removes the parentheses around a nested calc, this breaks the CSS aspect ratio calc.

You can at the moment work around this issue by;

  • Wrapping the value from the CSS variable in parentheses.
  • Using a multiplier instead
  • CSSNano: disabling the calc minification
cssnano: {
    preset: ['default', { calc: false }]
}

Find more about the postcss/postcss-calc issue on the github issue#91

Keywords

FAQs

Package last updated on 20 Jun 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc