Centering Any Element In JavaScript – centralize.js

Category: Javascript , Layout | November 7, 2019
Authorchigozieorunta
Last UpdateNovember 7, 2019
LicenseMIT
Tags
Views176 views
Centering Any Element In JavaScript – centralize.js

The centralize.js library provides a simple and cross-browser solution to center any element horizontal and vertical, without writing confusing CSS rules.

How to use it:

1. Link to stylesheet centralize.css and JavaScript centralize.js.

<link href="centralize.css" rel="stylesheet">
<script src="centralize.js"></script>

2. Add the CSS .centralize element to the element. That’s it.

<div class="centralize">
  <h1>I'm centralized<h1>
</div>

You Might Be Interested In:


Leave a Reply