Center responsive elements with a class, horizontally and vertically.


Download the plugin and include the script in your web page:

<script src="URL_to/upCenter.min.js"></script>

Use the class "upCenterV" to center vertically, and "upCenterH" to center horizontally your elements.
You can use the class on any html elements such as images, text or videos.

<a class="upCenterV upCenterH">In the middle !</a>

Inspired by the jquery plugin Midway.js, but in pure Javascript.

Via npm

Install it via npm :

npm install upcenter

Download this plugin, the zip folder contain the script files and additional components.

upCenter.js is licensed under The MIT License (MIT) This license is also supplied with the release and source code. As stated in the license, absolutely no warranty is provided. For more infos, this license goes with the zipped folder. Feel free to download and make it better.

Fork it

Fork, contribute and download on Github.

2013 — 2020