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

centered-css

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

centered-css

A centered, auto-scaling CSS box

  • 1.2.2
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Centered CSS framework

A centered, auto-scaling CSS box

NPM: https://www.npmjs.com/package/centered-css

Demo: https://tomsoderlund.github.io/centered-css/

Screenshot of Centered CSS

Install

yarn add centered-css

Add class centered on your element that you want centered.

Class centered portrait will make it in portrait aspect ratio, more suitable for phones.

Import in JavaScript

import '../node_modules/centered-css/dist/centered.min.css'

Optional: Add this for iOS Safari resize fix:

<script type="application/javascript">
  // iOS Safari resize fix
  function handleResize () { window.document.documentElement.style.setProperty('--vmin', `${Math.min(window.innerWidth, window.innerHeight) * 0.01}px`); };
  window.onresize = handleResize;
  handleResize();
</script>

or for React:

useLayoutEffect(() => {
  // iOS Safari resize fix in React
  function handleResize () { window.document.documentElement.style.setProperty('--vmin', `${Math.min(window.innerWidth, window.innerHeight) * 0.01}px`); };
  window.addEventListener('resize', handleResize);
  handleResize();
  return () => window.removeEventListener('resize', handleResize);
}, []);

Update NPM

yarn publish

(Will run yarn prepare automatically, which builds the /dist folder)

FAQs

Package last updated on 01 Apr 2022

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